Module: FacebookAds::GraphEdges::ClassMethods
- Defined in:
- lib/facebook_ads/helpers/edge_helpers.rb
Instance Method Summary collapse
Instance Method Details
#edge_classes ⇒ Object
17 18 19 |
# File 'lib/facebook_ads/helpers/edge_helpers.rb', line 17 def edge_classes @edge_classes end |
#has_edge(name) {|edge_class| ... } ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/facebook_ads/helpers/edge_helpers.rb', line 21 def has_edge(name, &block) edge_class = Class.new(Edge) yield edge_class @edge_classes ||= {} @edge_classes[name] = edge_class # delegate to field if name collides should_delegate = field_types.keys.include?(name) define_method(name) do |opts = {}| @edge_proxies ||= {} @edge_proxies["#{name}_#{self.class.(opts)}"] ||= begin edge_class.new(name, self, should_delegate, opts) end end end |
#options_hash(opts) ⇒ Object
40 41 42 |
# File 'lib/facebook_ads/helpers/edge_helpers.rb', line 40 def (opts) Digest::MD5.hexdigest(JSON.generate(opts)) end |