Sha256: 7128951c18de668c26d432481bcba062b2305650018bab018771cdfbfe8a988a

Contents?: true

Size: 445 Bytes

Versions: 26

Compression:

Stored size: 445 Bytes

Contents

module AngularSprinkles
  class ConstructorCollection
    def initialize(args)
      @json_wrapper = args.fetch(:json_wrapper)
      @object_wrapper = args.fetch(:object_wrapper)
      @collection = []
    end

    def push(object, key)
      bundle = @object_wrapper.new(object, key, @json_wrapper)

      @collection.push(bundle)
    end

    def to_json
      @collection.map!(&:to_json).join("\n")
    end
    alias :to_s :to_json
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
angular_sprinkles-0.3.3 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.3.2 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.3.1 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.3.0 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.14 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.13 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.12 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.11 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.10 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.9 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.8 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.7 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.6 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.5 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.4 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.3 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.2 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.1 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.2.0 lib/angular_sprinkles/constructor_collection.rb
angular_sprinkles-0.1.1 lib/angular_sprinkles/constructor_collection.rb