Sha256: 7c47f629b1db340a6963042532f5a3fcad6a0a68e5a527e2c7a2cffeebcdb606

Contents?: true

Size: 941 Bytes

Versions: 5

Compression:

Stored size: 941 Bytes

Contents

module Gosu
  class Color
    def _dump(_level)
      [
        "%02X" % alpha,
        "%02X" % red,
        "%02X" % green,
        "%02X" % blue
      ].join
    end

    def self._load(hex)
      argb(hex.to_i(16))
    end
  end
end

module CyberarmEngine
  class Style
    attr_reader :hash

    def initialize(hash = {})
      h = 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.empty?
        @hash[method]
      else
        raise ArgumentError, "Did not expect arguments"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cyberarm_engine-0.24.4 lib/cyberarm_engine/ui/style.rb
cyberarm_engine-0.24.3 lib/cyberarm_engine/ui/style.rb
cyberarm_engine-0.24.2 lib/cyberarm_engine/ui/style.rb
cyberarm_engine-0.24.1 lib/cyberarm_engine/ui/style.rb
cyberarm_engine-0.24.0 lib/cyberarm_engine/ui/style.rb