Class: Diffing::Part

Inherits:
Object
  • Object
show all
Defined in:
lib/diffing/part.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source: '', insert: '', delete: '') ⇒ Part

Returns a new instance of Part.



8
9
10
# File 'lib/diffing/part.rb', line 8

def initialize( source: '', insert: '', delete: '' )
  @source, @insert, @delete = source, insert, delete
end

Instance Attribute Details

#deleteObject (readonly)

Returns the value of attribute delete.



6
7
8
# File 'lib/diffing/part.rb', line 6

def delete
  @delete
end

#insertObject (readonly)

Returns the value of attribute insert.



6
7
8
# File 'lib/diffing/part.rb', line 6

def insert
  @insert
end

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/diffing/part.rb', line 6

def source
  @source
end

Instance Method Details

#delete?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/diffing/part.rb', line 20

def delete?
  not @delete.empty?
end

#insert?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/diffing/part.rb', line 16

def insert?
  not @insert.empty?
end

#replace?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/diffing/part.rb', line 24

def replace?
  not @insert.empty? and not @delete.empty?
end

#source?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/diffing/part.rb', line 12

def source?
  not @source.empty?
end