Class: EY::Account::ApiStruct
- Defined in:
- lib/engineyard/account/api_struct.rb
Class Method Summary collapse
Class Method Details
.new(*args, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/engineyard/account/api_struct.rb', line 4 def self.new(*args, &block) super(*args) do |*block_args| block.call(*block_args) if block def self.from_array(array, account = nil) array.map do |values| from_hash(values.merge(:account => account)) end if array end def self.from_hash(hash) return nil unless hash members = new.members values = members.map{|a| hash.has_key?(a.to_sym) ? hash[a.to_sym] : hash[a] } new(*values) end end end |