Sha256: 50f5152bb634c989458452cb1346ada347a3e71e597d24c3f50d1c1c717d7bc3

Contents?: true

Size: 642 Bytes

Versions: 8

Compression:

Stored size: 642 Bytes

Contents

#encoding: UTF-8
module Str2Duck
  module Config

    ::Str2Duck::Format.singleton_methods.each do |method|

      self.define_singleton_method "#{method}=" do |boolean|
        unless !!boolean == boolean
          raise( ArgumentError,"invalid value given #{boolean.inspect},input must be a boolean!" )
        end
        self.class_variable_set("@@#{method.to_s}",boolean)
      end

      self.define_singleton_method(method) do
        self.class_variable_get("@@#{method.to_s}")
      end

      self.class_variable_set("@@#{method.to_s}",true)

    end

    def self.list
      ::Str2Duck::Format.singleton_methods
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
str2duck-1.7.1 lib/str2duck/config.rb
str2duck-1.7.0 lib/str2duck/config.rb
str2duck-1.6.0 lib/str2duck/config.rb
str2duck-1.5.0 lib/str2duck/config.rb
str2duck-1.4.0 lib/str2duck/config.rb
str2duck-1.3.1 lib/str2duck/config.rb
str2duck-1.3.0 lib/str2duck/config.rb
str2duck-1.2.0 lib/str2duck/config.rb