Sha256: dca6813980839632b4790abf0ca0c8cf56567ad35744ceb5647f8bd7d1c7738d

Contents?: true

Size: 818 Bytes

Versions: 4

Compression:

Stored size: 818 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

4 entries across 4 versions & 1 rubygems

Version Path
roar-0.11.8 lib/roar/representer/feature/client.rb
roar-0.11.7 lib/roar/representer/feature/client.rb
roar-0.11.6 lib/roar/representer/feature/client.rb
roar-0.11.5 lib/roar/representer/feature/client.rb