Sha256: d3e40806969eb5427853f578e4ca10f177d8a47c1576f22a85f7390acef7a3c5

Contents?: true

Size: 569 Bytes

Versions: 5

Compression:

Stored size: 569 Bytes

Contents

module Restfulie
  module Common
    module Representation
      class Json
        class LinkCollection
          def initialize(parent_node)
            @node = parent_node
          end
          
          def method_missing(symbol, *args, &block)
            linkset = @node.select {|link| link.rel == symbol.to_s }
            linkset.map! { |link| Link.new(link) }
            unless linkset.empty?
              linkset.size == 1 ? linkset.first : linkset
            else
              nil
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
restfulie-1.0.0.beta1 lib/restfulie/common/representation/json/link_collection.rb
restfulie-0.1.0.beta1 lib/restfulie/common/representation/json/link_collection.rb
restfulie-0.9.3 lib/restfulie/common/representation/json/link_collection.rb
restfulie-0.9.1 lib/restfulie/common/representation/json/link_collection.rb
restfulie-0.8.1 lib/restfulie/common/representation/json/link_collection.rb