Class: A9n::Scope
- Inherits:
-
Object
- Object
- A9n::Scope
- Defined in:
- lib/a9n/scope.rb
Constant Summary collapse
- ROOT_NAMES =
[:configuration, :a9n].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #env_key_name(key) ⇒ Object
-
#initialize(name) ⇒ Scope
constructor
A new instance of Scope.
- #root? ⇒ Boolean
Constructor Details
#initialize(name) ⇒ Scope
Returns a new instance of Scope.
7 8 9 |
# File 'lib/a9n/scope.rb', line 7 def initialize(name) @name = name.to_sym end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/a9n/scope.rb', line 5 def name @name end |
Class Method Details
.form_file_path(path) ⇒ Object
19 20 21 |
# File 'lib/a9n/scope.rb', line 19 def self.form_file_path(path) new(File.basename(path.to_s).split('.').first.to_sym) end |
Instance Method Details
#env_key_name(key) ⇒ Object
15 16 17 |
# File 'lib/a9n/scope.rb', line 15 def env_key_name(key) (root? ? key : "#{name}_#{key}").upcase end |
#root? ⇒ Boolean
11 12 13 |
# File 'lib/a9n/scope.rb', line 11 def root? ROOT_NAMES.include?(name) end |