Class: Taxonifi::Splitter::Tokens::Pages

Inherits:
Token
  • Object
show all
Defined in:
lib/taxonifi/splitter/tokens.rb

Overview

A token to match page ranges, with remainders noted.

Instance Attribute Summary collapse

Attributes inherited from Token

#flag, #value

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Pages

Returns a new instance of Pages.



266
267
268
269
270
271
272
# File 'lib/taxonifi/splitter/tokens.rb', line 266

def initialize(str)
  str.strip 
  str =~ /\A\s*(\d+)\s*[-]?\s*(\d+)?\)?\s*[\.\,]?(.*)?/i
  @pg_start = $1 
  @pg_end = $2
  @remainder = $3.strip
end

Instance Attribute Details

#pg_endObject (readonly)

Returns the value of attribute pg_end.



263
264
265
# File 'lib/taxonifi/splitter/tokens.rb', line 263

def pg_end
  @pg_end
end

#pg_startObject (readonly)

Returns the value of attribute pg_start.



263
264
265
# File 'lib/taxonifi/splitter/tokens.rb', line 263

def pg_start
  @pg_start
end

#remainderObject (readonly)

Returns the value of attribute remainder.



263
264
265
# File 'lib/taxonifi/splitter/tokens.rb', line 263

def remainder
  @remainder
end