Class: LanguageTool::Resources::Match
- Inherits:
-
Object
- Object
- LanguageTool::Resources::Match
- Defined in:
- lib/languagetool/resources/match.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#replacements ⇒ Object
readonly
Returns the value of attribute replacements.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#short_message ⇒ Object
readonly
Returns the value of attribute short_message.
Instance Method Summary collapse
-
#initialize(json) ⇒ Match
constructor
A new instance of Match.
Constructor Details
#initialize(json) ⇒ Match
Returns a new instance of Match.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/languagetool/resources/match.rb', line 6 def initialize(json) @message = json['message'] @short_message = json['shortMessage'] @replacements = json['replacements'].map { |hash| hash['value'] }.freeze @offset = json['offset'] @length = json['length'] @context = Context.new json['context'] @rule = Rule.new json['rule'] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/languagetool/resources/match.rb', line 4 def context @context end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
4 5 6 |
# File 'lib/languagetool/resources/match.rb', line 4 def length @length end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/languagetool/resources/match.rb', line 4 def @message end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
4 5 6 |
# File 'lib/languagetool/resources/match.rb', line 4 def offset @offset end |
#replacements ⇒ Object (readonly)
Returns the value of attribute replacements.
4 5 6 |
# File 'lib/languagetool/resources/match.rb', line 4 def replacements @replacements end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
4 5 6 |
# File 'lib/languagetool/resources/match.rb', line 4 def rule @rule end |
#short_message ⇒ Object (readonly)
Returns the value of attribute short_message.
4 5 6 |
# File 'lib/languagetool/resources/match.rb', line 4 def @short_message end |