Sha256: 243ee538eb7d7f06fddb60e3e3376791a4b016ff4654a658f7dbaf4f170fdfbb

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

require 'hyperclient/collection'

module Hyperclient
  # Public: A wrapper class to easily acces the attributes in a Resource.
  #
  # Examples
  #
  #   resource.attributes['title']
  #   resource.attributes.title
  #
  class Attributes < Collection
    # Public: Initializes the Attributes of a Resource.
    #
    # representation - The hash with the HAL representation of the Resource.
    #
    def initialize(representation)
      @collection = representation.delete_if {|key, value| key =~ /^_/}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyperclient-0.2.0 lib/hyperclient/attributes.rb
hyperclient-0.1.0 lib/hyperclient/attributes.rb