Class: EPUB::CFI::Range

Inherits:
Range
  • Object
show all
Defined in:
lib/epub/cfi.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_subpathObject

Returns the value of attribute end_subpath.



155
156
157
# File 'lib/epub/cfi.rb', line 155

def end_subpath
  @end_subpath
end

#parent_pathObject

Returns the value of attribute parent_path.



155
156
157
# File 'lib/epub/cfi.rb', line 155

def parent_path
  @parent_path
end

#start_subpathObject

Returns the value of attribute start_subpath.



155
156
157
# File 'lib/epub/cfi.rb', line 155

def start_subpath
  @start_subpath
end

Class Method Details

.from_parent_and_start_and_end(parent_path, start_subpath, end_subpath) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/epub/cfi.rb', line 158

def from_parent_and_start_and_end(parent_path, start_subpath, end_subpath)
  first = Location.from_parent_and_subpath(parent_path, start_subpath)
  last = Location.from_parent_and_subpath(parent_path, end_subpath)

  new_range = new(first, last)

  new_range.parent_path = Location.new(parent_path)
  new_range.start_subpath = start_subpath.join("!")
  new_range.end_subpath = end_subpath.join("!")

  new_range
end

Instance Method Details

#to_sObject



172
173
174
# File 'lib/epub/cfi.rb', line 172

def to_s
  @string_cache ||= "epubcfi(#{@parent_path.path_string},#{@start_subpath},#{@end_subpath})"
end