Module: Locator::Decoding

Included in:
Locator
Defined in:
lib/locator/decoding.rb

Instance Method Summary collapse

Instance Method Details

#decode(value) ⇒ Object



15
16
17
# File 'lib/locator/decoding.rb', line 15

def decode(value)
  value.is_a?(String) ? html_entities.decode(value) : value
end

#decode_attributes(hash) ⇒ Object



11
12
13
# File 'lib/locator/decoding.rb', line 11

def decode_attributes(hash)
  Hash[*hash.map { |name, value| [name, decode(value)] }.flatten]
end

#decode_entities=(decode_entities) ⇒ Object



7
8
9
# File 'lib/locator/decoding.rb', line 7

def decode_entities=(decode_entities)
  @decode_entities = decode_entities
end

#decode_entities?Boolean

Returns:



3
4
5
# File 'lib/locator/decoding.rb', line 3

def decode_entities?
  @decode_entities ||= true
end