Class: MagnumPI::API::Scheme

Inherits:
DSL
  • Object
show all
Defined in:
lib/magnum-pi/api/scheme.rb

Instance Method Summary collapse

Methods inherited from DSL

#[], #class, #inspect, #slice, #to_hash, #to_s

Constructor Details

#initializeScheme

Returns a new instance of Scheme.



5
6
7
8
9
# File 'lib/magnum-pi/api/scheme.rb', line 5

def initialize
  super
  uri ::String
  format ::Symbol
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MagnumPI::DSL

Instance Method Details

#deep_cloneObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/magnum-pi/api/scheme.rb', line 25

def deep_clone
  clone = super

  types = @types.deep_clone if @types

  clone.instance_eval do
    @types = types
  end

  clone
end

#finalize(params = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/magnum-pi/api/scheme.rb', line 11

def finalize(params = {})
  @types = (types = _types).deep_clone
  @values = (values = _values).deep_clone

  params.each do |name, value|
    process_value name, [value], nil
  end

  to_hash
ensure
  @types = types
  @values = values
end