Class: Bowline::Binders::Collection::ItemsProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/bowline/binders/collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ ItemsProxy

Returns a new instance of ItemsProxy.



5
6
7
8
# File 'lib/bowline/binders/collection.rb', line 5

def initialize(&block)
  @callback = block
  @items = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/bowline/binders/collection.rb', line 14

def method_missing(*args, &block)
  diff = @items.hash
  res = @items.send(*args, &block)
  if diff != @items.hash
    @callback.call
  end
  res
end

Instance Method Details

#realObject



10
11
12
# File 'lib/bowline/binders/collection.rb', line 10

def real
  @items
end