lib/taketo/constructs/base_construct.rb in taketo-0.0.7 vs lib/taketo/constructs/base_construct.rb in taketo-0.0.8
- old
+ new
@@ -4,19 +4,31 @@
module Taketo
module Constructs
class BaseConstruct
include AssociatedNodes
- attr_reader :name
+ attr_reader :name, :default_server_config
def initialize(name)
super
@name = name
+ @default_server_config = proc {}
end
def node_type
demodulized = self.class.name.gsub(/.*::/, '')
demodulized.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase.to_sym
+ end
+
+ ##
+ # Override in subclasses if needed
+ def parent=(parent)
+ @default_server_config = parent.default_server_config
+ end
+
+ def default_server_config=(config)
+ default = @default_server_config
+ @default_server_config = proc { instance_eval(&default); instance_eval(&config) }
end
def qualified_name
"#{node_type} #{self.name}"
end