Class: EleetScript::MethodHash

Inherits:
Object
  • Object
show all
Defined in:
lib/lang/runtime/method_hash.rb

Instance Method Summary collapse

Constructor Details

#initializeMethodHash

Returns a new instance of MethodHash.



3
4
5
6
# File 'lib/lang/runtime/method_hash.rb', line 3

def initialize
  @instance_methods = {}
  @class_methods = {}
end

Instance Method Details

#[](key) ⇒ Object



8
9
10
11
12
# File 'lib/lang/runtime/method_hash.rb', line 8

def [](key)
  store = fetch_method_store(key)
  key = clean_key(key)
  store[key]
end

#[]=(key, value) ⇒ Object



14
15
16
17
18
# File 'lib/lang/runtime/method_hash.rb', line 14

def []=(key, value)
  store = fetch_method_store(key)
  key = clean_key(key)
  store[key] = value
end

#keysObject



20
21
22
23
24
# File 'lib/lang/runtime/method_hash.rb', line 20

def keys
  keys = @class_methods.keys.map { |k| "@@#{k}" }
  keys += @instance_methods.keys
  keys
end