Class: Yandex::API::Disk::BaseStruct

Inherits:
Struct
  • Object
show all
Defined in:
lib/yandex-api/disk.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ BaseStruct

Returns a new instance of BaseStruct.



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/yandex-api/disk.rb', line 84

def initialize(hash={})
  hash.each do |key, value|
    if self.respond_to?("#{key}=")
      if value =~ /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{2}:\d{2}/
        self.send("#{key}=", Time.parse(value))
      else
        self.send("#{key}=", value)
      end
    end
  end
end