Method: Pakyow::Presenter::Attributes::Set.parse
- Defined in:
- lib/pakyow/presenter/attributes/set.rb
.parse(value) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/pakyow/presenter/attributes/set.rb', line 48 def parse(value) if value.is_a?(Array) || value.is_a?(::Set) new(::Set.new(value.map { |v| ensure_html_safety(v) })) elsif value.respond_to?(:to_s) new(::Set.new(value.to_s.split(VALUE_SEPARATOR).map { |v| ensure_html_safety(v) })) else raise ArgumentError.new("expected value to be an Array, Set, or String") end end |