Class: CyberarmEngine::Style
- Inherits:
-
Object
- Object
- CyberarmEngine::Style
- Defined in:
- lib/cyberarm_engine/ui/style.rb
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Style
constructor
A new instance of Style.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Style
Returns a new instance of Style.
20 21 22 |
# File 'lib/cyberarm_engine/ui/style.rb', line 20 def initialize(hash = {}) @hash = Marshal.load(Marshal.dump(hash)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cyberarm_engine/ui/style.rb', line 24 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 elsif args.size == 0 return @hash[method] else raise ArgumentError, "Did not expect arguments" end end |