Sha256: 2ee2a8f02f5510e9bc0f7d2c3ef2848bb7b788d543558331a756dc8f6968e323

Contents?: true

Size: 856 Bytes

Versions: 8

Compression:

Stored size: 856 Bytes

Contents

require "roar/representer/feature/http_verbs"

module Roar
  # Automatically add accessors for properties and collections. Also mixes in HttpVerbs.
  module Representer
    module Feature
      module Client
        include HttpVerbs
        
        def self.extended(base)
          base.instance_eval do
            representable_attrs.each do |attr|
              next unless attr.instance_of? Representable::Definition # ignore hyperlinks etc for now.
              name = attr.name
              
              # TODO: could anyone please make this better?
              instance_eval %Q{
                def #{name}=(v)
                  @#{name} = v
                end
                
                def #{name}
                  @#{name}
                end
              }
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
roar-0.11.4 lib/roar/representer/feature/client.rb
roar-0.11.3 lib/roar/representer/feature/client.rb
roar-0.11.2 lib/roar/representer/feature/client.rb
roar-0.11.1 lib/roar/representer/feature/client.rb
roar-0.11.0 lib/roar/representer/feature/client.rb
roar-0.10.2 lib/roar/representer/feature/client.rb
roar-0.10.1 lib/roar/representer/feature/client.rb
roar-0.10.0 lib/roar/representer/feature/client.rb