Class: Kibutsu::Fixture

Inherits:
Object
  • Object
show all
Defined in:
lib/kibutsu/fixture.rb

Overview

Corresponds to one named fixture from a fixture file.

Constant Summary collapse

TIMESTAMP_COLUMN_NAMES =
%w[created_at updated_at].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, name, attributes) ⇒ Fixture

Returns a new instance of Fixture.



8
9
10
11
12
# File 'lib/kibutsu/fixture.rb', line 8

def initialize(table, name, attributes)
  @table = table
  @name = name
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



20
21
22
# File 'lib/kibutsu/fixture.rb', line 20

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



20
21
22
# File 'lib/kibutsu/fixture.rb', line 20

def name
  @name
end

#tableObject (readonly)

Returns the value of attribute table.



20
21
22
# File 'lib/kibutsu/fixture.rb', line 20

def table
  @table
end

Instance Method Details

#enriched_attributesObject



14
15
16
17
18
# File 'lib/kibutsu/fixture.rb', line 14

def enriched_attributes
  enriched_attributes = enrich_with_id(attributes)
  enriched_attributes = enrich_with_foreign_keys(enriched_attributes)
  enrich_with_timestamps(enriched_attributes)
end