Sha256: ff5919eb30737d607a9435c9d09d75b3ccc777b5ce254325bfd8e4ab9d2a05f5

Contents?: true

Size: 551 Bytes

Versions: 8

Compression:

Stored size: 551 Bytes

Contents

require 'rest-core/client'
require 'rest-core/wrapper'

class RestCore::Builder
  include RestCore
  include Wrapper

  def self.client *attrs, &block
    new(&block).to_client(*attrs)
  end

  def to_client *attrs
    # struct = Struct.new(*members, *attrs) if RUBY_VERSION >= 1.9.2
    struct = Struct.new(*(members + attrs))
    client = Class.new(struct)
    client.send(:include, Client)
    client.const_set('Struct', struct)
    class << client; attr_reader :builder; end
    client.instance_variable_set(:@builder, self)
    client
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rest-core-0.3.0 lib/rest-core/builder.rb
rest-core-0.3.0.pre.2 lib/rest-core/builder.rb
rest-core-0.3.0.pre.1 lib/rest-core/builder.rb
rest-core-0.3.0.pre.0 lib/rest-core/builder.rb
rest-core-0.2.3 lib/rest-core/builder.rb
rest-core-0.2.2 lib/rest-core/builder.rb
rest-core-0.2.1 lib/rest-core/builder.rb
rest-core-0.2.0 lib/rest-core/builder.rb