Method: Cieloz::Helpers::ClassMethods#attrs_from
- Defined in:
- lib/cieloz/helpers.rb
#attrs_from(source, opts, *keys) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cieloz/helpers.rb', line 18 def attrs_from source, opts, *keys attrs = keys.map { |k| value_or_attr_name = opts[k] || k if value_or_attr_name.is_a? Symbol source.send value_or_attr_name if source.respond_to? value_or_attr_name else value_or_attr_name end } attrs.count == 1 ? attrs.first : attrs end |