Class: Aspen::List
- Inherits:
-
Object
- Object
- Aspen::List
- Defined in:
- lib/aspen/list.rb
Constant Summary collapse
- REGEX =
/\s*,?\s*and\s*/i
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(array = []) ⇒ List
constructor
A new instance of List.
Constructor Details
#initialize(array = []) ⇒ List
Returns a new instance of List.
6 7 8 |
# File 'lib/aspen/list.rb', line 6 def initialize(array = []) @elements = Array(array) end |
Class Method Details
.from_text(text) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/aspen/list.rb', line 10 def self.from_text(text) new text. gsub(REGEX, ', '). split(','). map(&:strip) end |