Sha256: 95aa1e0fe2ba8db5a608ec068cbfdcd17564e998d99bf026eaf503d982ecb56d

Contents?: true

Size: 552 Bytes

Versions: 7

Compression:

Stored size: 552 Bytes

Contents

module Bowline
  module Binders
    class Collection < Base
      cattr_accessor :items
      class << self
        def items=(args)
          @@items = args
          self.item_sync!
          @@items
        end
    
        def item_sync!
          return unless @@items && @@elements
          @@elements.each {|i| 
            i.updateCollection(@@items.to_js) 
          }
        end
    
        def find(id)
          @@items.find {|item| 
            item.id == id if item.respond_to?(:id) 
          }
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
maccman-bowline-0.1.1 lib/bowline/binders/collection.rb
maccman-bowline-0.1.2 lib/bowline/binders/collection.rb
maccman-bowline-0.1.3 lib/bowline/binders/collection.rb
maccman-bowline-0.1.4 lib/bowline/binders/collection.rb
maccman-bowline-0.1.6 lib/bowline/binders/collection.rb
maccman-bowline-0.1.7 lib/bowline/binders/collection.rb
bowline-0.1.6 lib/bowline/binders/collection.rb