Method: Axiom::Attribute#initialize

Defined in:
lib/axiom/attribute.rb

#initialize(name, options = EMPTY_HASH) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize an Attribute

Parameters:

  • name (#to_sym)

    the attribute name

  • options (Hash) (defaults to: EMPTY_HASH)

    the options for the attribute

Options Hash (options):

  • :required (Boolean) — default: true

    if true, then the value cannot be nil



90
91
92
93
94
# File 'lib/axiom/attribute.rb', line 90

def initialize(name, options = EMPTY_HASH)
  @name     = name.to_sym
  @options  = freeze_object(options)
  @required = @options.fetch(:required, true)
end