Class: NeuronCheckSystem::KeywordPluginMatcher

Inherits:
MatcherBase
  • Object
show all
Defined in:
lib/neuroncheck/matcher.rb

Overview

プラグインで追加されたキーワード用

Instance Attribute Summary

Attributes inherited from MatcherBase

#declared_caller_locations

Instance Method Summary collapse

Methods inherited from MatcherBase

#get_error_message

Constructor Details

#initialize(keyword, declared_caller_locations) ⇒ KeywordPluginMatcher

Returns a new instance of KeywordPluginMatcher.



216
217
218
219
# File 'lib/neuroncheck/matcher.rb', line 216

def initialize(keyword, declared_caller_locations)
  @keyword = keyword
  @declared_caller_locations = declared_caller_locations
end

Instance Method Details

#expected_captionObject



226
227
228
229
# File 'lib/neuroncheck/matcher.rb', line 226

def expected_caption
  @keyword.api = Plugin::KeywordAPI.new(@declared_caller_locations)
  @keyword.expected_caption
end

#expected_short_captionObject



231
232
233
234
# File 'lib/neuroncheck/matcher.rb', line 231

def expected_short_caption
  @keyword.api = Plugin::KeywordAPI.new(@declared_caller_locations)
  @keyword.expected_short_caption
end

#keyword_nameObject



241
242
243
# File 'lib/neuroncheck/matcher.rb', line 241

def keyword_name
  (@keyword.class).instance_variable_get(:@keyword_name).to_s
end

#match?(value, self_object) ⇒ Boolean

Returns:

  • (Boolean)


221
222
223
224
# File 'lib/neuroncheck/matcher.rb', line 221

def match?(value, self_object)
  @keyword.api = Plugin::KeywordAPI.new(@declared_caller_locations, self_object)
  @keyword.match?(value)
end

#meta_info_as_jsonObject



236
237
238
239
# File 'lib/neuroncheck/matcher.rb', line 236

def meta_info_as_json
  @keyword.api = Plugin::KeywordAPI.new(@declared_caller_locations)
  super.update('keyword' => keyword_name, 'expected_caption' => expected_caption).tap{|x| x.delete('expected')}.update(@keyword.get_params_as_json)
end