Class: TwitterCldr::Shared::PropertyNormalizer

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/shared/property_normalizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database) ⇒ PropertyNormalizer

Returns a new instance of PropertyNormalizer.



12
13
14
# File 'lib/twitter_cldr/shared/property_normalizer.rb', line 12

def initialize(database)
  @database = database
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



10
11
12
# File 'lib/twitter_cldr/shared/property_normalizer.rb', line 10

def database
  @database
end

Instance Method Details

#normalize(property_name, property_value = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/twitter_cldr/shared/property_normalizer.rb', line 16

def normalize(property_name, property_value = nil)
  candidates = find_property_name_candidates(property_name)

  if property_value
    name, value = resolve_candidates(candidates, property_value)
  else
    candidates.each do |c|
      if name = resolve_property_name_case(c)
        break
      end
    end

    value = nil
  end

  [name, value]
end