Class: ODDB::State::PageFacade

Inherits:
Array show all
Defined in:
src/state/page_facade.rb

Direct Known Subclasses

OffsetPageFacade

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Array

#obj_path

Constructor Details

- (PageFacade) initialize(int)

A new instance of PageFacade



8
9
10
11
# File 'src/state/page_facade.rb', line 8

def initialize(int)
  super()
  @int = int
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

- (Object) method_missing(name, *args, &block)



24
25
26
# File 'src/state/page_facade.rb', line 24

def method_missing(name, *args, &block)
  @model.send(name, *args, &block)
end

Instance Attribute Details

- (Object) model

Returns the value of attribute model



7
8
9
# File 'src/state/page_facade.rb', line 7

def model
  @model
end

Instance Method Details

- (Object) next



12
13
14
# File 'src/state/page_facade.rb', line 12

def next
  PageFacade.new(@int.next)
end

- (Object) previous



15
16
17
# File 'src/state/page_facade.rb', line 15

def previous
  PageFacade.new(@int-1)
end

- (Boolean) respond_to?(name)

Returns:

  • (Boolean)


27
28
29
# File 'src/state/page_facade.rb', line 27

def respond_to?(name)
  super || @model.respond_to?(name)
end

- (Object) to_i



21
22
23
# File 'src/state/page_facade.rb', line 21

def to_i
  @int
end

- (Object) to_s



18
19
20
# File 'src/state/page_facade.rb', line 18

def to_s
  @int.next.to_s
end