Class: Ingreedy::Dictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/ingreedy/dictionary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries = {}) ⇒ Dictionary

Returns a new instance of Dictionary.



5
6
7
8
9
# File 'lib/ingreedy/dictionary.rb', line 5

def initialize(entries = {})
  @units = entries[:units] || raise("No units found in dictionary")
  @numbers = entries[:numbers] || {}
  @prepositions = entries[:prepositions] || []
end

Instance Attribute Details

#numbersObject (readonly)

Returns the value of attribute numbers.



3
4
5
# File 'lib/ingreedy/dictionary.rb', line 3

def numbers
  @numbers
end

#prepositionsObject (readonly)

Returns the value of attribute prepositions.



3
4
5
# File 'lib/ingreedy/dictionary.rb', line 3

def prepositions
  @prepositions
end

#unitsObject (readonly)

Returns the value of attribute units.



3
4
5
# File 'lib/ingreedy/dictionary.rb', line 3

def units
  @units
end

Instance Method Details

#vulgar_fractionsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ingreedy/dictionary.rb', line 12

def vulgar_fractions
  {
    "\u00BC" => "1/4",
    "\u00BD" => "1/2",
    "\u00BE" => "3/4",
    "\u2150" => "1/7",
    "\u2151" => "1/9",
    "\u2152" => "1/10",
    "\u2153" => "1/3",
    "\u2154" => "2/3",
    "\u2155" => "1/5",
    "\u2156" => "2/5",
    "\u2157" => "3/5",
    "\u2158" => "4/5",
    "\u2159" => "1/6",
    "\u215A" => "5/6",
    "\u215B" => "1/8",
    "\u215C" => "3/8",
    "\u215D" => "5/8",
    "\u215E" => "7/8",
  }
end