Class: Define::Word_lookup
- Inherits:
-
Object
- Object
- Define::Word_lookup
- Defined in:
- lib/define.rb
Instance Method Summary collapse
- #definition ⇒ Object
-
#initialize(word) ⇒ Word_lookup
constructor
A new instance of Word_lookup.
- #type ⇒ Object
Constructor Details
#initialize(word) ⇒ Word_lookup
Returns a new instance of Word_lookup.
7 8 9 10 |
# File 'lib/define.rb', line 7 def initialize (word) @word = word @full_def = look_up end |
Instance Method Details
#definition ⇒ Object
12 13 14 |
# File 'lib/define.rb', line 12 def definition @full_def end |
#type ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/define.rb', line 16 def type matchdata = @full_def.match /^\s+(?<word>#{@word})\s+(?<type>\w+)\s+\d:/ type = matchdata[:type] case type when "n" then :noun when "adv" then :adverb when "adj" then :adjective when "v" then :verb end end |