Class: CastingAttrAccessor::Parser::Flags
- Defined in:
- lib/casting_attr_accessor/parser/flags.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#default_value, #initialize, #readers, #storage_var, #writers
Constructor Details
This class inherits a constructor from CastingAttrAccessor::Parser::Base
Instance Method Details
#parse(values) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/casting_attr_accessor/parser/flags.rb', line 5 def parse(values) raise ArgumentError.new 'Flags attribute has to specify a set of possible values' unless .key?(:from) array = super(values) array.map!(&:to_sym) array.select! { |v| [:from].include?(v) } array end |