### Home Classes Methods

### In Files

- lib/spreadsheet/link.rb

### Parent

String

### Methods

- ::new
- #href
- #to_uri

### Included Modules

- Spreadsheet::Encodings

### Files

- LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Spreadsheet
- Spreadsheet::Column
- Spreadsheet::Compatibility
- Spreadsheet::Datatypes
- Spreadsheet::Encodings
- Spreadsheet::Excel
- Spreadsheet::Excel::Error
- Spreadsheet::Excel::ExcelCompatibleWorkbook
- Spreadsheet::Excel::Internals
- Spreadsheet::Excel::Internals::Biff5
- Spreadsheet::Excel::Internals::Biff8
- Spreadsheet::Excel::Offset
- Spreadsheet::Excel::Password
- Spreadsheet::Excel::Reader
- Spreadsheet::Excel::Reader::Biff5
- Spreadsheet::Excel::Rgb
- Spreadsheet::Excel::Row
- Spreadsheet::Excel::SstEntry
- Spreadsheet::Excel::Workbook
- Spreadsheet::Excel::Worksheet
- Spreadsheet::Font
- Spreadsheet::Format
- Spreadsheet::Formula
- Spreadsheet::Helpers
- Spreadsheet::Link
- Spreadsheet::Note
- Spreadsheet::NoteObject
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel::Worksheet
- Spreadsheet::ParseExcel::Worksheet::Cell
- Spreadsheet::Row
- Spreadsheet::Workbook
- Spreadsheet::Worksheet
- Spreadsheet::Writer

No matching classes.

# Spreadsheet::Link

The Link class. Is a Subclass of String, which lets you treat a Cell that contains a Link just as if it was a String (containing the link's description if there is one or the url with fragment otherwise), but gives you access to the url, fragment and target_frame if you need it.

Interesting Attributes

url | The Uniform Resource Location this Link points to.
fragment | Also called text mark: example.com/page.html#fragment
target_frame | Which frame a Link should be opened in, should also support the special frames _blank, _parent, _self and _top.
dos | Excel may store a DOS-Filename together with the long Filename introduced in VFAT. You probably will not need this, but if you do, here is where you can find it.

### Attributes

dos[RW]
fragment[RW]
target_frame[RW]
url[RW]

### Public Class Methods

new(url='', description=url, fragment=nil) click to toggle source

    # File lib/spreadsheet/link.rb, line 23
    def initialize url='', description=url, fragment=nil
      super description
      @url = url
      @fragment = fragment
    end

### Public Instance Methods

href() click to toggle source

The Url with the fragment appended if present.

    # File lib/spreadsheet/link.rb, line 30
    def href
      href = (@url || @dos).to_s.dup
      if @fragment
        href << client('#', 'UTF-8') << @fragment
      end
      href
    end

to_uri() click to toggle source

Attempts to parse the output of href. May raise a URI::InvalidURIError

    # File lib/spreadsheet/link.rb, line 39
    def to_uri
      URI.parse href
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.