Module: AbstractMapper::Attributes

Included in:
Node
Defined in:
lib/abstract_mapper/attributes.rb

Overview

Defines attributes along with the DSL for setting them

Defined Under Namespace

Modules: DSL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesHash (readonly)

Returns The initialized attributes.

Returns:

  • (Hash)

    The initialized attributes



18
19
20
# File 'lib/abstract_mapper/attributes.rb', line 18

def attributes
  @attributes
end

Class Method Details

.included(klass) ⇒ Object



10
11
12
# File 'lib/abstract_mapper/attributes.rb', line 10

def self.included(klass)
  klass.__send__ :extend, DSL
end

Instance Method Details

#initialize(attributes) ⇒ Object

Initializes the instance with the hash of attributes

Parameters:

  • attributes (Hash)


24
25
26
# File 'lib/abstract_mapper/attributes.rb', line 24

def initialize(attributes)
  @attributes = Functions[:restrict, self.class.attributes][attributes]
end