Class: Ansr::Group
- Inherits:
-
Object
- Object
- Ansr::Group
- Defined in:
- lib/ansr/relation/group.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
the field from which the key value was selected.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(group_key, model, group) ⇒ Group
constructor
A new instance of Group.
-
#records ⇒ Object
model instances belonging to this group.
-
#start ⇒ Object
offset in the response.
-
#total ⇒ Object
size of the group.
Constructor Details
#initialize(group_key, model, group) ⇒ Group
Returns a new instance of Group.
5 6 7 8 9 |
# File 'lib/ansr/relation/group.rb', line 5 def initialize(group_key, model, group) @field, @key = group_key.first @model = model @group = group end |
Instance Attribute Details
#field ⇒ Object (readonly)
the field from which the key value was selected
27 28 29 |
# File 'lib/ansr/relation/group.rb', line 27 def field @field end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
4 5 6 |
# File 'lib/ansr/relation/group.rb', line 4 def group @group end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/ansr/relation/group.rb', line 4 def key @key end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'lib/ansr/relation/group.rb', line 4 def model @model end |
Instance Method Details
#records ⇒ Object
model instances belonging to this group
22 23 24 |
# File 'lib/ansr/relation/group.rb', line 22 def records raise "Group#records must be implemented by subclass" end |
#start ⇒ Object
offset in the response
17 18 19 |
# File 'lib/ansr/relation/group.rb', line 17 def start raise "Group#start must be implemented by subclass" end |
#total ⇒ Object
size of the group
12 13 14 |
# File 'lib/ansr/relation/group.rb', line 12 def total raise "Group#total must be implemented by subclass" end |