Class: Taxonifi::Splitter::Tokens::VolumeNumber

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

Overview

A token to match volume-number combinations, with various possible formats.

Instance Attribute Summary collapse

Attributes inherited from Token

#flag, #value

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ VolumeNumber

Returns a new instance of VolumeNumber.



251
252
253
254
255
256
257
258
# File 'lib/taxonifi/splitter/tokens.rb', line 251

def initialize(str)
  str.strip 
  str =~ /\A\s*([^:(]+)\s*[:\(]?\s*([^:)]+)?\)?\s*/i
  @volume = $1
  @number = $2
  @volume && @volume.strip!
  @number && @number.strip!
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



246
247
248
# File 'lib/taxonifi/splitter/tokens.rb', line 246

def number
  @number
end

#volumeObject (readonly)

Returns the value of attribute volume.



246
247
248
# File 'lib/taxonifi/splitter/tokens.rb', line 246

def volume
  @volume
end