Class: Halogen::Definitions

Inherits:
Hash
  • Object
show all
Defined in:
lib/halogen/definitions.rb

Overview

Each representer class has a Halogen::Definitions instance which stores Halogen::Definition instances by type.

Instance Method Summary collapse

Instance Method Details

#add(definition) ⇒ Halogen::Definition

Returns the added definition.

Parameters:

Returns:


12
13
14
15
16
17
18
19
20
21
# File 'lib/halogen/definitions.rb', line 12

def add(definition)
  type = definition.class.name

  definition.validate

  self[type] ||= []
  self[type] << definition

  definition
end