Class: Rose::Proxy::Row
- Inherits:
-
Object
- Object
- Rose::Proxy::Row
- Defined in:
- lib/rose/proxy.rb
Overview
This class is used by the DSL to collect a row of attributes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Rose::Attribute::Collection
readonly
Each attribute defines how values are generated for that column as well how that column is named.
-
#identity_attribute ⇒ Rose::Attribute
readonly
Attribute used to determine which column is the id column.
Class Method Summary collapse
Instance Method Summary collapse
- #column(name, &blk) ⇒ Object
- #identity(name, &blk) ⇒ Object
-
#initialize ⇒ Row
constructor
A new instance of Row.
Constructor Details
#initialize ⇒ Row
Returns a new instance of Row.
16 17 18 |
# File 'lib/rose/proxy.rb', line 16 def initialize @attributes = Attribute::Collection.new end |
Instance Attribute Details
#attributes ⇒ Rose::Attribute::Collection (readonly)
Each attribute defines how values are generated for that column as well how that column is named
10 11 12 |
# File 'lib/rose/proxy.rb', line 10 def attributes @attributes end |
#identity_attribute ⇒ Rose::Attribute (readonly)
Returns attribute used to determine which column is the id column.
14 15 16 |
# File 'lib/rose/proxy.rb', line 14 def identity_attribute @identity_attribute end |
Class Method Details
.name_and_title(name) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/rose/proxy.rb', line 29 def self.name_and_title(name) case name when Hash name.to_a.first else [name, nil] end end |
Instance Method Details
#column(name, &blk) ⇒ Object
20 21 22 |
# File 'lib/rose/proxy.rb', line 20 def column(name, &blk) @attributes << attribute(name, &blk) end |
#identity(name, &blk) ⇒ Object
24 25 26 27 |
# File 'lib/rose/proxy.rb', line 24 def identity(name, &blk) column(name, &blk) @identity_attribute = @attributes.last end |