Class: Wakame::Service::VmSpec::Template
- Inherits:
-
Object
- Object
- Wakame::Service::VmSpec::Template
- Defined in:
- lib/wakame/service.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #attrs ⇒ Object
-
#initialize ⇒ Template
constructor
A new instance of Template.
- #satisfy?(agent) ⇒ Boolean
Constructor Details
#initialize ⇒ Template
Returns a new instance of Template.
642 643 644 645 646 647 648 649 |
# File 'lib/wakame/service.rb', line 642 def initialize @attribute_keys=[] self.class.default_attr_values.each { |n, v| instance_variable_set("@#{n.to_s}", v) #self.instance_eval %Q{ #{n} = #{v} } @attribute_keys << n } end |
Class Method Details
.inherited(klass) ⇒ Object
630 631 632 633 634 635 636 637 638 639 640 |
# File 'lib/wakame/service.rb', line 630 def self.inherited(klass) klass.class_eval { def self.default_attr_values @default_attr_values ||= {} end def self.def_attribute(name, default_value=nil) default_attr_values[name.to_sym]= default_value attr_accessor(name) end } end |
Instance Method Details
#attrs ⇒ Object
651 652 653 654 655 656 657 |
# File 'lib/wakame/service.rb', line 651 def attrs a={} @attribute_keys.each { |k| a[k.to_sym]=instance_variable_get("@#{k.to_s}") } a end |
#satisfy?(agent) ⇒ Boolean
659 660 661 |
# File 'lib/wakame/service.rb', line 659 def satisfy?(agent) true end |