Module: SettingFunctional::Method

Included in:
Settings, Settings
Defined in:
lib/settings/setting_functional.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



30
31
32
# File 'lib/settings/setting_functional.rb', line 30

def method_missing(method_name, *args)
	rule_method(method_name, *args)
end

Instance Attribute Details

#targetObject

Returns the value of attribute target.



3
4
5
# File 'lib/settings/setting_functional.rb', line 3

def target
  @target
end

Instance Method Details

#[](key) ⇒ Object



9
10
11
# File 'lib/settings/setting_functional.rb', line 9

def [](key)
	get_key(key)
end

#[]=(key, value) ⇒ Object



5
6
7
# File 'lib/settings/setting_functional.rb', line 5

def []=(key, value)			
	add_key(key, value)
end

#allObject



21
22
23
24
25
26
27
28
# File 'lib/settings/setting_functional.rb', line 21

def all
	keys = get_setting.first
	keys.map do | k |
		temp = {}
		temp[k.var] = k.value				
		temp
	end
end

#destroy(key) ⇒ Object



17
18
19
# File 'lib/settings/setting_functional.rb', line 17

def destroy(key)
	get_setting(key).first.destroy
end

#destroy_allObject



13
14
15
# File 'lib/settings/setting_functional.rb', line 13

def destroy_all
	get_setting.first.destroy_all
end