Class: Rose::Proxy::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/rose/proxy.rb

Overview

This class is used by the DSL to collect a row of attributes

Direct Known Subclasses

Summary

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRow

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

#attributesRose::Attribute::Collection (readonly)

Each attribute defines how values are generated for that column as well how that column is named

Returns:



10
11
12
# File 'lib/rose/proxy.rb', line 10

def attributes
  @attributes
end

#identity_attributeRose::Attribute (readonly)

Returns attribute used to determine which column is the id column.

Returns:

  • (Rose::Attribute)

    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