Class: Sequel::Mapper::Struct

Inherits:
Struct
  • Object
show all
Defined in:
lib/sequel/mapper/struct.rb

Instance Method Summary collapse

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