Sha256: 091e36361a0d535e47abc88cc8d4e6e464272cb93d8d77e6e248c4e778af6fe4

Contents?: true

Size: 532 Bytes

Versions: 5

Compression:

Stored size: 532 Bytes

Contents

require 'active_support/core_ext/hash'

module NetworkExecutive
  class Configuration
    attr_accessor :name

    @@defaults = HashWithIndifferentAccess.new(
      name: 'My Network'
    )

    def initialize
      @@defaults.dup.each_pair { |k, v| self.send "#{k}=", v }
    end

    def defaults
      @@defaults
    end

    def attributes
      self.class.defaults.keys.each_with_object(HashWithIndifferentAccess.new) do |k, hash|
        hash[k] = self.send k
      end
    end
    alias_method :to_hash, :attributes
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
network_executive-0.0.8 lib/network_executive/configuration.rb
network_executive-0.0.7 lib/network_executive/configuration.rb
network_executive-0.0.4 lib/network_executive/configuration.rb
network_executive-0.0.3 lib/network_executive/configuration.rb
network_executive-0.0.2 lib/network_executive/configuration.rb