Sha256: 9744989cc7aca0c011fa670d400afe6d881e7b62e2c70fd5fa5a4775e65aff5d

Contents?: true

Size: 403 Bytes

Versions: 10

Compression:

Stored size: 403 Bytes

Contents

module A9n
  class Scope
    ROOT_NAME = :configuration

    attr_reader :name

    def initialize(name)
      @name = name.to_sym
    end

    def root?
      name == ROOT_NAME
    end

    def env_key_name(key)
      (root? ? key : "#{name}_#{key}").upcase
    end

    def self.form_file_path(path)
      name = File.basename(path.to_s).split('.').first.to_sym
      self.new(name)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
a9n-0.6.1 lib/a9n/scope.rb
a9n-0.6.0 lib/a9n/scope.rb
a9n-0.5.7 lib/a9n/scope.rb
a9n-0.5.6 lib/a9n/scope.rb
a9n-0.5.5 lib/a9n/scope.rb
a9n-0.5.4 lib/a9n/scope.rb
a9n-0.5.2 lib/a9n/scope.rb
a9n-0.5.1 lib/a9n/scope.rb
a9n-0.5.0 lib/a9n/scope.rb
a9n-0.4.12 lib/a9n/scope.rb