lib/cyberarm_engine/ui/style.rb in cyberarm_engine-0.17.1 vs lib/cyberarm_engine/ui/style.rb in cyberarm_engine-0.18.0
- old
+ new
@@ -15,22 +15,33 @@
end
end
module CyberarmEngine
class Style
+ attr_reader :hash
+
def initialize(hash = {})
- @hash = Marshal.load(Marshal.dump(hash))
+ h = Marshal.load(Marshal.dump(hash))
+
+ h[:default] = {}
+
+ h.each do |key, value|
+ next if value.is_a?(Hash)
+
+ h[:default][key] = value
+ end
+
+ @hash = h
end
def method_missing(method, *args)
if method.to_s.end_with?("=")
raise "Did not expect more than 1 argument" if args.size > 1
@hash[method.to_s.sub("=", "").to_sym] = args.first
- elsif args.size == 0
+ elsif args.empty?
@hash[method]
-
else
raise ArgumentError, "Did not expect arguments"
end
end
end