class CyberarmEngine::Style

Attributes

hash[R]

Public Class Methods

new(hash = {}) click to toggle source
# File lib/cyberarm_engine/ui/style.rb, line 22
def initialize(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

Public Instance Methods

method_missing(method, *args) click to toggle source
# File lib/cyberarm_engine/ui/style.rb, line 36
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.empty?
    @hash[method]
  else
    raise ArgumentError, "Did not expect arguments"
  end
end