Sha256: efc6023419f3ee894699e06c33816e1beb58061d91c88c852955a2e5dcbceedb

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

require 'singleton'
module Sym
  module Configurable
    def self.included(base)
      base.instance_eval do
        include Singleton

        class << self
          def config
            instance
          end

          def configure
            yield config if block_given?
            config
          end

          def property(prop_name, prop_value = nil)
            config.send("#{prop_name}=", prop_value) if prop_name && prop_value
            config.send(prop_name)
          end

          alias_method :[], :property
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sym-crypt-1.2.0 lib/sym/configurable.rb