Class: Text::Gen::Filter::Clear

Inherits:
Base
  • Object
show all
Defined in:
lib/text/gen/filter/clear.rb

Overview

Clear removes result meta

Instance Method Summary collapse

Methods inherited from Base

#component_key, filter_key, filter_name, #initialize, #key, #to_s, #type, #value

Constructor Details

This class inherits a constructor from Text::Gen::Filter::Base

Instance Method Details

#result(context, result) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/text/gen/filter/clear.rb', line 8

def result(context, result)
  return result if @depth && context.depth != @depth

  new_meta = Text::Gen::Meta.clear_kv(result.meta, key, value)
  return result if new_meta == result.meta

  Result.from(result, type: component_key, meta: new_meta)
end