Class: Rich::I18n::Core::EnrichedString

Inherits:
Object
  • Object
show all
Defined in:
lib/rich/i18n/core/enriched_string.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string = "", meta_data = nil) ⇒ EnrichedString

Returns a new instance of EnrichedString.



11
12
13
14
# File 'lib/rich/i18n/core/enriched_string.rb', line 11

def initialize(string = "",  = nil)
  @string    = string
  @meta_data =  || (s..dup unless (string..nil? rescue true)) || {}
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



9
10
11
# File 'lib/rich/i18n/core/enriched_string.rb', line 9

def string
  @string
end

Instance Method Details

#enriched_string?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/rich/i18n/core/enriched_string.rb', line 16

def enriched_string?
  true
end

#to_esObject Also known as: to_s



20
21
22
# File 'lib/rich/i18n/core/enriched_string.rb', line 20

def to_es
  (@meta_data.filled? && Engine.can_enrich_output?) ? to_tag : @string
end