class Converter

Public Class Methods

new(obj, type, id = nil) click to toggle source
# File lib/vimamsa/text_transforms.rb, line 2
def initialize(obj, type, id = nil)
  @obj = obj
  @type = type
  if id != nil
    $vma.reg_conv(self, id)
  end
end

Public Instance Methods

apply(txt) click to toggle source
# File lib/vimamsa/text_transforms.rb, line 10
def apply(txt)
  if @type == :gsub
    return txt.gsub(@obj[0], @obj[1])
  elsif @type == :lambda
    return @obj.call(txt)
  end
end