Class: Ansr::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/ansr/relation/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fieldObject (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

#groupObject (readonly)

Returns the value of attribute group.



4
5
6
# File 'lib/ansr/relation/group.rb', line 4

def group
  @group
end

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/ansr/relation/group.rb', line 4

def key
  @key
end

#modelObject (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

#recordsObject

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

#startObject

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

#totalObject

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