Sha256: 515baf0ef6db060132c2feae02ced66d1d2edb3f0ee532ee96687025029358ba

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

require 'radix/base'
require 'radix/integer'
require 'radix/float'
require 'radix/rational'
require 'radix/operator'

module Radix

  ##
  # Returns the metadata contained in Radix.yml
  #
  # @return [Hash{String=>String}]
  def self.metadata
    @metadata ||= (
      require 'yaml'
      YAML.load(File.new(File.dirname(__FILE__) + '/radix.yml'))
    )
  end

  ##
  # Gets value of name in metadata or goes up ancestry.
  #
  # @param [Symbol] name
  #
  # @return [String]
  def self.const_missing(name)
    key = name.to_s.downcase
    metadata.key?(key) ? metadata[key] : super(name)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radix-2.2.1 lib/radix.rb
radix-2.2.0 lib/radix.rb