Class: LanguageTool::Resources::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/languagetool/resources/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/languagetool/resources/match.rb', line 4

def context
  @context
end

#lengthObject (readonly)

Returns the value of attribute length.



4
5
6
# File 'lib/languagetool/resources/match.rb', line 4

def length
  @length
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/languagetool/resources/match.rb', line 4

def message
  @message
end

#offsetObject (readonly)

Returns the value of attribute offset.



4
5
6
# File 'lib/languagetool/resources/match.rb', line 4

def offset
  @offset
end

#replacementsObject (readonly)

Returns the value of attribute replacements.



4
5
6
# File 'lib/languagetool/resources/match.rb', line 4

def replacements
  @replacements
end

#ruleObject (readonly)

Returns the value of attribute rule.



4
5
6
# File 'lib/languagetool/resources/match.rb', line 4

def rule
  @rule
end

#short_messageObject (readonly)

Returns the value of attribute short_message.



4
5
6
# File 'lib/languagetool/resources/match.rb', line 4

def short_message
  @short_message
end