Class: IronHammer::Deliverables::Deliverable

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_hammer/deliverables/deliverable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Deliverable

Returns a new instance of Deliverable.



9
10
11
12
13
14
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 9

def initialize params={}
  @actual_path = params[:actual_path] || raise(ArgumentError.new 'must provide an actual_path')
  @actual_name = params[:actual_name] || raise(ArgumentError.new 'must provide an actual_name')
  @path_on_package = params[:path_on_package] || @actual_path
  @name_on_package = params[:name_on_package] || @actual_name
end

Instance Attribute Details

#actual_nameObject

Returns the value of attribute actual_name.



5
6
7
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 5

def actual_name
  @actual_name
end

#actual_pathObject

Returns the value of attribute actual_path.



4
5
6
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 4

def actual_path
  @actual_path
end

#name_on_packageObject

Returns the value of attribute name_on_package.



7
8
9
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 7

def name_on_package
  @name_on_package
end

#path_on_packageObject

Returns the value of attribute path_on_package.



6
7
8
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 6

def path_on_package
  @path_on_package
end

Class Method Details

.create(actual_path, actual_name, path_on_package = '') ⇒ Object



16
17
18
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 16

def self.create actual_path, actual_name, path_on_package=''
  Deliverable.new :actual_path => actual_path, :actual_name => actual_name, :path_on_package => path_on_package
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
23
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 20

def == other
  other.class == Deliverable &&
    instance_variables.inject(true) { |x, current| x && (send(prop = current.to_s.sub('@','')) == other.send(prop)) }
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/iron_hammer/deliverables/deliverable.rb', line 25

def eql? other
  self == other
end