Class: Filter8::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/filter8/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Result

Returns a new instance of Result.



5
6
7
# File 'lib/filter8/result.rb', line 5

def initialize(json)
  @json = json
end

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



3
4
5
# File 'lib/filter8/result.rb', line 3

def json
  @json
end

Instance Method Details

#matched?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/filter8/result.rb', line 13

def matched?
  @json["filter"]["matched"]
end

#matchesObject



17
18
19
# File 'lib/filter8/result.rb', line 17

def matches
  @json["filter"]["matches"].map { |match| OpenStruct.new(match) }
end

#replacementObject



9
10
11
# File 'lib/filter8/result.rb', line 9

def replacement
  @json["filter"]["replacement"]
end