Class: ModelX::Base

Inherits:
Object
  • Object
show all
Includes:
Mixin
Defined in:
lib/model_x/base.rb

Overview

Base ModelX class. Does nothing more than include Mixin and define a constructor.

Instance Method Summary collapse

Methods included from Mixin

#persisted?, #to_key

Methods included from Boolean

convert

Methods included from Attributes

#[], #assign_attributes, #attributes, #attributes=

Constructor Details

#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