Class: SubDiff::Sub

Inherits:
Object
  • Object
show all
Defined in:
lib/sub_diff/sub.rb

Direct Known Subclasses

Gsub

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(differ) ⇒ Sub

Returns a new instance of Sub.



5
6
7
# File 'lib/sub_diff/sub.rb', line 5

def initialize(differ)
  @differ = differ
end

Instance Attribute Details

#differObject (readonly)

Returns the value of attribute differ.



3
4
5
# File 'lib/sub_diff/sub.rb', line 3

def differ
  @differ
end

Instance Method Details

#diff(*args, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/sub_diff/sub.rb', line 9

def diff(*args, &block)
  # Ruby 1.8.7 does not support additional args after * (splat)
  args.push(block)

  differ.each_diff(*args) do |builder, diff|
    process(builder, diff, args.first)
  end
end