Class: RADT::Record
- Inherits:
-
Object
- Object
- RADT::Record
- Extended by:
- Forwardable
- Defined in:
- lib/radt/record.rb
Overview
An instance of RADT::Record represents a row in the RADT file
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Equality.
-
#initialize(table) ⇒ Record
constructor
Initialize a new ADT::Record.
-
#to_a ⇒ Array
Maps a row to an array of values.
Constructor Details
#initialize(table) ⇒ Record
Initialize a new ADT::Record
13 14 15 16 17 18 |
# File 'lib/radt/record.rb', line 13 def initialize(table) @table, @data = table, table.data initialize_values define_accessors end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/radt/record.rb', line 6 def attributes @attributes end |
Instance Method Details
#==(other) ⇒ Boolean
Equality
24 25 26 |
# File 'lib/radt/record.rb', line 24 def ==(other) other.respond_to?(:attributes) && other.attributes == attributes end |
#to_a ⇒ Array
Maps a row to an array of values
31 32 33 |
# File 'lib/radt/record.rb', line 31 def to_a columns.map { |column| @attributes[column.name.underscore] } end |