Class: Wakame::Service::VmSpec

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/wakame/service.rb

Defined Under Namespace

Classes: EC2, StandAlone, Template

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.currentObject



934
935
936
# File 'lib/wakame/service.rb', line 934

def self.current
  environment(Wakame.config.environment)
end

.environment(klass_key) ⇒ Object



938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
# File 'lib/wakame/service.rb', line 938

def self.environment(klass_key)
  @templates ||= {}

  tmpl_klass = @templates[klass_key]
  if tmpl_klass.nil?
    #klass = self.class.constants.find{ |c| c.to_s == klass_key.to_s }
    if self.const_defined?(klass_key)
      tmpl_klass = @templates[klass_key] = Util.build_const([self.to_s, klass_key.to_s].join('::'))
    else
      raise "Undefined VM Spec Template : #{klass_key}"
    end
  end

  self.new(tmpl_klass.new)
end

Instance Method Details

#attrsObject



971
972
973
# File 'lib/wakame/service.rb', line 971

def attrs
  table
end

#merge(src_vm_attr) ⇒ Object



979
980
981
# File 'lib/wakame/service.rb', line 979

def merge(src_vm_attr)
  @template.merge(src_vm_attr, table)
end

#satisfy?(vm_attr) ⇒ Boolean

Returns:

  • (Boolean)


975
976
977
# File 'lib/wakame/service.rb', line 975

def satisfy?(vm_attr)
  @template.satisfy?(vm_attr, table)
end

#table=(vm_attr) ⇒ Object



967
968
969
# File 'lib/wakame/service.rb', line 967

def table=(vm_attr)
  @table = vm_attr
end