Sha256: b66a0f65b06d52dc055542635e4b55ee65937ca897466271a40916a0581bd30c

Contents?: true

Size: 512 Bytes

Versions: 4

Compression:

Stored size: 512 Bytes

Contents

module Lionel
  module Configurable
    def self.included(base)
      base.extend ClassMethods
    end

    def configuration
      Configuration.instance
    end

    def save
      configuration.save(data)
    end

    def data
      {}
    end

  end

  module ClassMethods

    def config_accessor(*args)
      attr_writer(*args)

      args.each do |reader|
        define_method(reader) do
          instance_variable_get("@#{reader}") || configuration.send(reader)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lionel_richie-0.1.3 lib/lionel/configurable.rb
lionel_richie-0.1.2 lib/lionel/configurable.rb
lionel_richie-0.1.1 lib/lionel/configurable.rb
lionel_richie-0.1.0 lib/lionel/configurable.rb