class Chemlab::Component::DSL
DSL
for both components and resources.
Public Class Methods
new(base)
click to toggle source
# File lib/chemlab/component.rb, line 100 def initialize(base) @base = base end
Public Instance Methods
attribute(name) { |: nil| ... }
click to toggle source
An attribute to define for a component or resource
# File lib/chemlab/component.rb, line 105 def attribute(name) @base.module_eval do attr_writer(name) default_value = block_given? ? yield : nil define_singleton_method(name) do |value = nil| instance_variable_get("@#{name}") || instance_variable_set( "@#{name}", value || default_value ) end end end