Class: Datacaster::I18nValues::Scope

Inherits:
Base
  • Object
show all
Defined in:
lib/datacaster/i18n_values/scope.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#args

Instance Method Summary collapse

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

#scopeObject (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

#inspectObject



23
24
25
# File 'lib/datacaster/i18n_values/scope.rb', line 23

def inspect
  "#<#{self.class.name}(#{@scope.inspect}) #{@args.inspect}>"
end

#resolveObject

Raises:

  • (RuntimeError)


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