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.



162
163
164
# File 'lib/epub/cfi.rb', line 162

def end_subpath
  @end_subpath
end

#parent_pathObject

Returns the value of attribute parent_path.



162
163
164
# File 'lib/epub/cfi.rb', line 162

def parent_path
  @parent_path
end

#start_subpathObject

Returns the value of attribute start_subpath.



162
163
164
# File 'lib/epub/cfi.rb', line 162

def start_subpath
  @start_subpath
end

Class Method Details

.from_parent_and_start_and_end(parent_path, start_subpath, end_subpath) ⇒ Object



165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/epub/cfi.rb', line 165

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



179
180
181
# File 'lib/epub/cfi.rb', line 179

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