Module: AwarenessApi::FeedAttributes
Overview
Adds the dynamic attributes to each feed class
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *params, &block) ⇒ Object
149 150 151 152 153 154 155 156 |
# File 'lib/awareness_api.rb', line 149 def method_missing(method, *params, &block) method = method.to_s if method =~ /=/ self.instance_variable_set("@#{method[0..-2]}", params[0]) else self.instance_variable_get("@#{method}") end end |
Instance Method Details
#attributes ⇒ Object
138 139 140 141 142 143 144 145 146 147 |
# File 'lib/awareness_api.rb', line 138 def attributes attribute_hash = {} self.instance_variables.each do |var| var_symbol = var[1..-1].to_sym attribute_hash[var_symbol] = self.send(var_symbol) unless self.send(var_symbol).is_a?(Array) end attribute_hash end |