Class: AmberVM::Classes::Association

Inherits:
Hash
  • Object
show all
Extended by:
Plugin
Defined in:
lib/amber/classes/association.rb

Constant Summary collapse

@@type =
:association

Instance Method Summary collapse

Methods included from Plugin

helper, included, plugin_host, plugin_id, register_for

Constructor Details

#initialize(source = {}, sepperator = ' ') ⇒ Association

Returns a new instance of Association.



27
28
29
30
31
32
# File 'lib/amber/classes/association.rb', line 27

def initialize source= {}, sepperator = ' '
  super()
  if source.is_a?(::Hash) # Okay we've to hack here to get sure we get the /real/ String
    self.merge! source
  end
end

Instance Method Details

#data_typeObject



9
10
11
# File 'lib/amber/classes/association.rb', line 9

def data_type
  :list
end

#functionsObject



18
19
20
21
22
23
24
25
# File 'lib/amber/classes/association.rb', line 18

def functions
  @functions ||= {
    'size' => AmberVM::Functions[:size],
    'length' => AmberVM::Functions[:size],
    'get' => AmberVM::Functions[:assoc_get],
    'set' => AmberVM::Functions[:assoc_set],          
  }
end

#variablesObject



13
14
15
# File 'lib/amber/classes/association.rb', line 13

def variables
  @variables ||= {}
end