Class: JLDrill::Deinflection::Reason

Inherits:
String
  • Object
show all
Defined in:
lib/jldrill/model/DeinflectionRules.rb

Overview

Represents a deinflection reason. In other words when you deinflect the verb using a rule, what rule reason was it. For example “past negative”

Class Method Summary collapse

Class Method Details

.isReason?(string) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/jldrill/model/DeinflectionRules.rb', line 12

def Reason::isReason?(string)
    # All of the rules in the deinflection file are tab separated.
    # Therefore if a line doesn't contain a tab then it is a reason 
    !string.include?("\t")
end

.parse(string) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/jldrill/model/DeinflectionRules.rb', line 18

def Reason::parse(string)
    if Reason::isReason?(string)
        return Reason.new(string.chomp)
    else
        return nil
    end
end