Class: Faalis::Dashboard::FormFieldsProperties
- Inherits:
-
Object
- Object
- Faalis::Dashboard::FormFieldsProperties
show all
- Defined in:
- lib/faalis/dashboard/dsl/form_fields_properties.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/faalis/dashboard/dsl/form_fields_properties.rb', line 45
def method_missing(m, *args, &block)
@fields ||= {}
if self.respond_to? m
return self.send(m, *args, &block)
else
@fields[m] = args[0]
end
end
|
Instance Method Details
#[](index) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/faalis/dashboard/dsl/form_fields_properties.rb', line 38
def [](index)
unless @fields.nil?
return @fields[index] || {}
end
{}
end
|
#[]=(name, detail) ⇒ Object
33
34
35
36
|
# File 'lib/faalis/dashboard/dsl/form_fields_properties.rb', line 33
def []=(name, detail)
@fields ||= {}
@fields[name.to_sym] = detail
end
|
#fields ⇒ Object
29
30
31
|
# File 'lib/faalis/dashboard/dsl/form_fields_properties.rb', line 29
def fields
@fields || {}
end
|
#fields=(all_fields) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/faalis/dashboard/dsl/form_fields_properties.rb', line 8
def fields=(all_fields)
fields.each do |name, field|
unless all_fields.include? name.to_s
raise ArgumentError, "'#{name}' is not a valid field"
end
end
all_fields.each do |name, field|
unless fields.include?(name.to_sym)
Rails.logger.debug("FIELD NAME: #{name}")
Rails.logger.debug("FIELD TYPE: #{field.type}")
if self.respond_to?("setup_#{field.type}".to_sym, true)
puts "sdasda" * 100
send("setup_#{field.type}", name)
end
end
end
end
|
#initializer ⇒ Object
4
5
6
|
# File 'lib/faalis/dashboard/dsl/form_fields_properties.rb', line 4
def initializer
@fields = {}
end
|
#to_hash ⇒ Object
56
57
58
|
# File 'lib/faalis/dashboard/dsl/form_fields_properties.rb', line 56
def to_hash
fields
end
|