Class: Songbirdsh::RangeExpander

Inherits:
Object
  • Object
show all
Defined in:
lib/songbirdsh/range_expander.rb

Instance Method Summary collapse

Instance Method Details

#expand(text) ⇒ Object



3
4
5
# File 'lib/songbirdsh/range_expander.rb', line 3

def expand text
  text.split(/[^0-9a-z-]/).inject([]) {|acc, term| acc + expand_term(term) }
end

#expand_to_ids(text) ⇒ Object



7
8
9
# File 'lib/songbirdsh/range_expander.rb', line 7

def expand_to_ids text
  expand(text).map {|number| from_number number }
end