Method: ModelX::Base#initialize

Defined in:
lib/model_x/base.rb

#initialize(attributes = {}) {|self| ... } ⇒ Base

Initializes the ModelX class by assigning all specified attributes.

Yields:

  • (self)

    Yields the new model if a block is given



12
13
14
15
# File 'lib/model_x/base.rb', line 12

def initialize(attributes = {})
  self.attributes = attributes if attributes.present?
  yield self if block_given?
end