Module: FacebookAds::Fields::ClassMethods
- Defined in:
- lib/facebook_ads/fields.rb
Instance Attribute Summary collapse
-
#deserializer ⇒ Object
Returns the value of attribute deserializer.
-
#field_types ⇒ Object
Returns the value of attribute field_types.
Instance Method Summary collapse
Instance Attribute Details
#deserializer ⇒ Object
Returns the value of attribute deserializer.
14 15 16 |
# File 'lib/facebook_ads/fields.rb', line 14 def deserializer @deserializer end |
#field_types ⇒ Object
Returns the value of attribute field_types.
14 15 16 |
# File 'lib/facebook_ads/fields.rb', line 14 def field_types @field_types end |
Instance Method Details
#define_reader(name) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/facebook_ads/fields.rb', line 29 def define_reader(name) define_method(name) do if !@__all_fields.include?(name) @__all_fields << name Utils.logger.warn("#{name} not in the fields") end load! unless loaded? if changes.has_key?(name) changes[name] else @attributes[name] end end end |
#define_writer(name) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/facebook_ads/fields.rb', line 46 def define_writer(name) define_method("#{name}=") do |val| changes[name] = val @__all_fields.add(name.to_s) end end |
#field(name, type, *args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/facebook_ads/fields.rb', line 16 def field(name, type, *args) self.field_types ||= {} self.field_types[name] = type unless name == :id define_reader(name) define_writer(name) end self.deserializer ||= ParamSet.new self.deserializer.has_param(name, type, *args) end |