Module: Piwik::DataMethods::InstanceMethods
- Defined in:
- lib/piwik/data_methods.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
try to pass method to the data variable
43
44
45
46
47
48
49
50
51
|
# File 'lib/piwik/data_methods.rb', line 43
def method_missing(method, *args, &block)
if self.data.respond_to?(method)
typecast(self.data.send(method,*args,&block))
elsif self.data.is_a?(Hash) && self.data.key?(method.to_s)
typecast(self.data[method.to_s])
else
super
end
end
|
Instance Method Details
#empty? ⇒ Boolean
30
31
32
|
# File 'lib/piwik/data_methods.rb', line 30
def empty?
data.blank? and value.blank?
end
|
#initialize(opts = {}) ⇒ Object
38
39
40
|
# File 'lib/piwik/data_methods.rb', line 38
def initialize opts = {}
opts.map {|k,v| self.send(:"#{k}=",v) }
end
|
#value ⇒ Object
34
35
36
|
# File 'lib/piwik/data_methods.rb', line 34
def value
typecast(@value)
end
|