Class: Glossarist::Designation::GrammarInfo

Inherits:
Object
  • Object
show all
Includes:
Utilities::BooleanAttributes, Utilities::CommonFunctions, Utilities::Enum
Defined in:
lib/glossarist/designation/grammar_info.rb

Instance Method Summary collapse

Methods included from Utilities::CommonFunctions

#slice_keys, #symbolize_keys

Methods included from Utilities::BooleanAttributes

extended, included

Methods included from Utilities::Enum

extended, included

Constructor Details

#initialize(options = {}) ⇒ GrammarInfo

Returns a new instance of GrammarInfo.



17
18
19
20
21
# File 'lib/glossarist/designation/grammar_info.rb', line 17

def initialize(options = {})
  sanitized_options(options).each do |attr, value|
    public_send("#{attr}=", value)
  end
end

Instance Method Details

#part_of_speech=(pos) ⇒ Object



23
24
25
# File 'lib/glossarist/designation/grammar_info.rb', line 23

def part_of_speech=(pos)
  public_send("#{pos}=", pos)
end

#to_hObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/glossarist/designation/grammar_info.rb', line 27

def to_h
  {
    "preposition" => preposition?,
    "participle" => participle?,
    "adj" => adj?,
    "verb" => verb?,
    "adverb" => adverb?,
    "noun" => noun?,
    "gender" => gender,
    "number" => number,
  }
end