Class: Sequel::Mapper::Struct
- Inherits:
-
Struct
- Object
- Struct
- Sequel::Mapper::Struct
- Defined in:
- lib/sequel/mapper/struct.rb
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Struct
constructor
A new instance of Struct.
- #slice(*keys) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Struct
Returns a new instance of Struct.
4 5 6 |
# File 'lib/sequel/mapper/struct.rb', line 4 def initialize(args={}) args.each { |k,v| self[k] = v if members.include?(k.to_sym) } end |
Instance Method Details
#slice(*keys) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/sequel/mapper/struct.rb', line 8 def slice(*keys) keys.reduce({}) do |hash, key| hash[key] = self[key] hash end end |