Class: Datacaster::I18nValues::Scope
- Defined in:
- lib/datacaster/i18n_values/scope.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Attributes inherited from Base
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(scope, args = {}) ⇒ Scope
constructor
A new instance of Scope.
- #inspect ⇒ Object
- #resolve ⇒ Object
- #with_args(args) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(scope, args = {}) ⇒ Scope
Returns a new instance of Scope.
6 7 8 9 |
# File 'lib/datacaster/i18n_values/scope.rb', line 6 def initialize(scope, args = {}) @scope = scope @args = args end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
4 5 6 |
# File 'lib/datacaster/i18n_values/scope.rb', line 4 def scope @scope end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 |
# File 'lib/datacaster/i18n_values/scope.rb', line 11 def ==(other) super && @scope == other.scope end |
#inspect ⇒ Object
23 24 25 |
# File 'lib/datacaster/i18n_values/scope.rb', line 23 def inspect "#<#{self.class.name}(#{@scope.inspect}) #{@args.inspect}>" end |
#resolve ⇒ Object
15 16 17 |
# File 'lib/datacaster/i18n_values/scope.rb', line 15 def resolve raise RuntimeError.new("Tried to resolve i18n scope #{@scope.inspect}. Use #i18n_key in addition to #i18n_scope.") end |
#with_args(args) ⇒ Object
19 20 21 |
# File 'lib/datacaster/i18n_values/scope.rb', line 19 def with_args(args) self.class.new(@scope, @args.merge(args)) end |