class Warg::Config::VariableSet
Attributes
context[R]
properties[R]
Public Class Methods
new(name, context)
click to toggle source
# File lib/warg.rb, line 1287 def initialize(name, context) @_name = name @context = context # FIXME: make this "private" by adding an underscore @properties = Set.new end
Public Instance Methods
context=(*)
click to toggle source
# File lib/warg.rb, line 1294 def context=(*) raise NotImplementedError end
copy(other)
click to toggle source
# File lib/warg.rb, line 1306 def copy(other) other.properties.each do |property_name| value = other.instance_variable_get("@#{property_name}") extend Property.new(property_name, value) end end
define!(property_name)
click to toggle source
# File lib/warg.rb, line 1302 def define!(property_name) @properties << property_name.to_s end
defined?(property_name)
click to toggle source
# File lib/warg.rb, line 1298 def defined?(property_name) @properties.include?(property_name.to_s) end
to_h()
click to toggle source
# File lib/warg.rb, line 1314 def to_h @properties.each_with_object({}) do |property_name, variables| variables["#{@_name}_#{property_name}"] = send(property_name) end end
Protected Instance Methods
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/warg.rb, line 1324 def method_missing(name, *args, &block) writer_name = name.to_s reader_name = writer_name.chomp("=") if reader_name !~ Property::REGEXP super elsif reader_name == writer_name && block.nil? $stderr.puts "`#{@_name}.#{reader_name}' was accessed before it was defined" nil elsif writer_name.end_with?("=") or not block.nil? value = block || args extend Property.new(reader_name, *value) end end