Class: Cukedep::FileAction

Inherits:
Object
  • Object
show all
Defined in:
lib/cukedep/file-action.rb

Direct Known Subclasses

CopyAction, DeleteAction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(thePatterns, aDelta = nil) ⇒ FileAction

Constructor. [thePatterns] An array of file patterns.



13
14
15
16
# File 'lib/cukedep/file-action.rb', line 13

def initialize(thePatterns, aDelta = nil)
  @patterns = validate_file_patterns(thePatterns)
  @delta = validate_delta(aDelta)
end

Instance Attribute Details

#deltaObject (readonly)

Returns the value of attribute delta.



9
10
11
# File 'lib/cukedep/file-action.rb', line 9

def delta
  @delta
end

#patternsObject

Returns the value of attribute patterns.



8
9
10
# File 'lib/cukedep/file-action.rb', line 8

def patterns
  @patterns
end

Instance Method Details

#==(other) ⇒ Object

Datavalue semantic: FileActions don't have identity



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cukedep/file-action.rb', line 19

def ==(other)
  return true if object_id == other.object_id
  return false if self.class != other.class

  attrs = %I[patterns delta]
  equality = true

  attrs.each do |accessor|
    equality = send(accessor) == other.send(accessor)
    break unless equality
  end

  return equality
end