Sha256: 91611c3e1c5789d2af0524319b471b7498240289744c4dae8e00f1718f0d49a5

Contents?: true

Size: 704 Bytes

Versions: 4

Compression:

Stored size: 704 Bytes

Contents

require 'forwardable'
require 'chozo/varia_model'

module Chozo
  module Config
    # @author Jamie Winsor <jamie@vialstudios.com>
    # @api private
    class Abstract
      include VariaModel
      
      attr_accessor :path

      # @param [String] path
      # @param [Hash] attributes
      def initialize(path = nil, attributes = {})
        @path = File.expand_path(path) if path

        mass_assign(attributes)
      end

      def [](key)
        self.attributes[key]
      end

      def []=(key, value)
        self.attributes[key] = value
      end

      protected

        def mass_assign(new_attributes = {})
          attributes.deep_merge!(new_attributes)
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chozo-0.2.3 lib/chozo/config/abstract.rb
chozo-0.2.2 lib/chozo/config/abstract.rb
chozo-0.2.1 lib/chozo/config/abstract.rb
chozo-0.2.0 lib/chozo/config/abstract.rb