Class: SimpleSearchFilter::FilterData
- Inherits:
-
Object
- Object
- SimpleSearchFilter::FilterData
show all
- Defined in:
- lib/simple_search_filter/filter_data.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_sym, *arguments, &block) ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/simple_search_filter/filter_data.rb', line 47
def method_missing(method_sym, *arguments, &block)
name = method_sym.to_s
if v_exist?(name)
return v(name)
else
super
end
end
|
Instance Attribute Details
#values ⇒ Object
Returns the value of attribute values.
5
6
7
|
# File 'lib/simple_search_filter/filter_data.rb', line 5
def values
@values
end
|
Instance Method Details
#clear ⇒ Object
41
42
43
|
# File 'lib/simple_search_filter/filter_data.rb', line 41
def clear
@values = {}
end
|
#set(name, v) ⇒ Object
32
33
34
|
# File 'lib/simple_search_filter/filter_data.rb', line 32
def set(name, v)
values[name.to_s] = v
end
|
#set_values(a_values) ⇒ Object
36
37
38
39
|
# File 'lib/simple_search_filter/filter_data.rb', line 36
def set_values(a_values)
@values = a_values
end
|
#v(name, v_def = nil) ⇒ Object
13
14
15
16
17
|
# File 'lib/simple_search_filter/filter_data.rb', line 13
def v(name, v_def=nil)
name = name.to_s
return values[name] if v_exist?(name)
v_def
end
|
#v_empty?(name) ⇒ Boolean
19
20
21
22
23
24
25
26
|
# File 'lib/simple_search_filter/filter_data.rb', line 19
def v_empty?(name)
a = values
if (a.has_key? name) && (!a[name].nil?)
return true
end
false
end
|
#v_exist?(name) ⇒ Boolean
28
29
30
|
# File 'lib/simple_search_filter/filter_data.rb', line 28
def v_exist?(name)
values.has_key? name
end
|