lib/cyberarm_engine/ui/style.rb in cyberarm_engine-0.7.1 vs lib/cyberarm_engine/ui/style.rb in cyberarm_engine-0.8.0

- old
+ new

@@ -1,15 +1,20 @@ module CyberarmEngine class Style - def initialize(hash) + def initialize(hash = {}) @hash = hash end - def hash - @hash - end + def method_missing(method, *args, &block) + if method.to_s.end_with?("=") + raise "Did not expect more than 1 argument" if args.size > 1 + return @hash[method.to_s.sub("=", "").to_sym] = args.first - def set(hash) - @hash.merge!(hash) + elsif args.size == 0 + return @hash[method] + + else + raise ArgumentError, "Did not expect arguments" + end end end end \ No newline at end of file