Sha256: f0163f8f4e27e1f64aed55e28ff30490892267098e0abfc1883fa6990b331c0e

Contents?: true

Size: 829 Bytes

Versions: 5

Compression:

Stored size: 829 Bytes

Contents

require 'ns-options/version'
require 'ns-options/root_methods'
require 'ns-options/proxy'
require 'ns-options/struct'

module NsOptions

  def self.included(receiver)
    receiver.class_eval { extend NsOptions::DSL }
  end

  def self.distinct_value(value)
    begin
      value.clone
    rescue TypeError
      value
    end
  end

  module DSL

    # This is the main DSL method for creating a namespace of options for your
    # class/module. This will define a class method for classes/modules and
    # an additional instance method for classes.

    def options(name, *args, &block)
      NsOptions::RootMethods.new(self, name).define($stdout, caller)
      self.send(name, *args, &block)
    end
    alias_method :opts,      :options
    alias_method :namespace, :options
    alias_method :ns,        :options

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ns-options-1.1.6 lib/ns-options.rb
ns-options-1.1.5 lib/ns-options.rb
ns-options-1.1.4 lib/ns-options.rb
ns-options-1.1.3 lib/ns-options.rb
ns-options-1.1.2 lib/ns-options.rb