Module: Contentful::MiddlemanPages::ResourceInstanceMethods

Defined in:
lib/contentful/middleman-pages/extension.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args, &block) ⇒ Object



20
21
22
23
# File 'lib/contentful/middleman-pages/extension.rb', line 20

def method_missing(symbol, *args, &block)
  return data.fetch(symbol.to_s) if key_in_data(symbol)
  super
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/contentful/middleman-pages/extension.rb', line 8

def data
  @data
end

Instance Method Details

#ignored?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/contentful/middleman-pages/extension.rb', line 10

def ignored?
  # As we are ignoring the template used to render this resource
  # the resources won't be rendered. We have to force it.
  false
end

#respond_to?(symbol) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/contentful/middleman-pages/extension.rb', line 16

def respond_to?(symbol)
   key_in_data(symbol) || super
end