Method: Plant::Core::ClassMethods#get_node_content

Defined in:
lib/plant/core.rb

#get_node_content(node_id, options = {}) ⇒ Object

Convenience method to get the content of a given node

=> Paramter: node ID (string)
=> Paramter: Options (hash)
 - scenario
   Can either be a string or an object with
   a scenario method, for example a user

 - Also can be any arbitary key to be injected into the
   returned content. For example
   When called get_node_content(node_id, foo: 'hhh)
   "This is content for #{foo} and bar"
   will return 'This is content for hhh and bar'

Note: If second parameter is a string, it will be treated as
scenario.

Also see: get_node



51
52
53
54
55
# File 'lib/plant/core.rb', line 51

def get_node_content(node_id, options = {})
  options = { scenario: options } unless options.is_a? Hash
  options = defaults.merge(options)
  inject_content(get_node(node_id, options).content, options)
end