Module: Alchemy::Element::Definitions::ClassMethods

Defined in:
app/models/alchemy/element/definitions.rb

Instance Method Summary collapse

Instance Method Details

#definition_by_name(name) ⇒ Object

Returns one element definition by given name.


21
22
23
# File 'app/models/alchemy/element/definitions.rb', line 21

def definition_by_name(name)
  definitions.detect { |d| d["name"] == name }
end

#definitionsObject

Returns the definitions from elements.yml file.

Place a elements.yml file inside your apps config/alchemy folder to define your own set of elements


15
16
17
# File 'app/models/alchemy/element/definitions.rb', line 15

def definitions
  @definitions ||= read_definitions_file.map(&:with_indifferent_access)
end