Module: RemoteResource::Dsl

Included in:
Base
Defined in:
lib/remote_resource/base/dsl.rb

Overview

Our humble DSL

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#client_procObject (readonly)

Returns the value of attribute client_proc.



4
5
6
# File 'lib/remote_resource/base/dsl.rb', line 4

def client_proc
  @client_proc
end

#resourcesObject (readonly)

Returns the value of attribute resources.



4
5
6
# File 'lib/remote_resource/base/dsl.rb', line 4

def resources
  @resources
end

Instance Method Details

#attribute(method, named_resource = :default) ⇒ Object



19
20
21
# File 'lib/remote_resource/base/dsl.rb', line 19

def attribute(method, named_resource = :default)
  attributes[method] = named_resource
end

#attributesObject



23
24
25
# File 'lib/remote_resource/base/dsl.rb', line 23

def attributes
  @attributes ||= {}
end

#client(&block) ⇒ Object



6
7
8
# File 'lib/remote_resource/base/dsl.rb', line 6

def client(&block)
  @client_proc = block if block
end

#resource(name = :default, &block) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/remote_resource/base/dsl.rb', line 10

def resource(name = :default, &block)
  if block
    @resources ||= {}
    @resources[name] = block
  else
    fail ArgumentError, 'must supply a block'
  end
end