Class: HaveAPI::Fs::HashWrapper

Inherits:
Client::Resource
  • Object
show all
Defined in:
lib/haveapi/fs/hash_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, api, resource, action, data) ⇒ HashWrapper

Returns a new instance of HashWrapper.



3
4
5
6
7
8
9
10
11
# File 'lib/haveapi/fs/hash_wrapper.rb', line 3

def initialize(client, api, resource, action, data)
  super(client, api, resource._name)
  setup(resource.instance_variable_get('@description'))

  @data = data
  @data.each do |k, v|
    define_singleton_method(k) { v }
  end
end

Instance Method Details

#[](k) ⇒ Object



17
18
19
# File 'lib/haveapi/fs/hash_wrapper.rb', line 17

def [](k)
  @data[k]
end

#[]=(k, v) ⇒ Object



21
22
23
# File 'lib/haveapi/fs/hash_wrapper.rb', line 21

def []=(k, v)
  @data[k] = v
end

#attributesObject



13
14
15
# File 'lib/haveapi/fs/hash_wrapper.rb', line 13

def attributes
  @data
end