Class: Jcsv::RBGsub

Inherits:
Filter show all
Defined in:
lib/filters.rb

Overview

Instance Attribute Summary

Attributes included from NextFilter

#last_filter, #next_filter

Instance Method Summary collapse

Methods included from NextFilter

#>>, #exec_next

Constructor Details

#initialize(*args, block: nil) ⇒ RBGsub

Returns a new instance of RBGsub.



245
246
247
248
249
# File 'lib/filters.rb', line 245

def initialize(*args, block: nil)
  @args = args
  @block = block
  super()
end

Instance Method Details

#execute(value, context) ⇒ Object



251
252
253
254
# File 'lib/filters.rb', line 251

def execute(value, context)
  value = (@block)? @block.call(value, *(@args)) : value.gsub(*(@args))
  exec_next(value, context)
end