Class: Server

Inherits:
Object
  • Object
show all
Defined in:
lib/tiki/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(url = nil, description = nil) ⇒ Server

Returns a new instance of Server.



27
28
29
30
# File 'lib/tiki/server.rb', line 27

def initialize(url = nil, description = nil)
  @url = url
  @description = description
end

Instance Method Details

#to_specObject



49
50
51
52
53
54
# File 'lib/tiki/server.rb', line 49

def to_spec
  props = {}
  scalar_props props
  hash_props props
  props
end

#variable(name, default = nil, **named, &block) ⇒ Object



32
33
34
35
36
37
# File 'lib/tiki/server.rb', line 32

def variable(name, default = nil, **named, &block)
  @variables ||= []
  variable = ServerVariable.new default, **named
  variable.instance_eval(&block) if block
  @variables << [name, variable]
end

#variables(**vars) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/tiki/server.rb', line 39

def variables(**vars)
  vars.each_pair do |name, value|
    if value.is_a? Array
      variable name, value.first, enum: value
    else
      variable name, value
    end
  end
end