Class: Bookbinder::BlueGreenApp

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/blue_green_app.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ BlueGreenApp

Returns a new instance of BlueGreenApp.



3
4
5
# File 'lib/bookbinder/blue_green_app.rb', line 3

def initialize(name)
  @name = name.strip
end

Instance Method Details

#==(other) ⇒ Object



7
8
9
# File 'lib/bookbinder/blue_green_app.rb', line 7

def ==(other)
  to_s == other.to_s
end

#to_sObject



11
12
13
# File 'lib/bookbinder/blue_green_app.rb', line 11

def to_s
  name
end

#with_flipped_nameObject



15
16
17
18
19
20
21
# File 'lib/bookbinder/blue_green_app.rb', line 15

def with_flipped_name
  if name.match(/green$/)
    BlueGreenApp.new(name.sub(/green$/, 'blue'))
  else
    BlueGreenApp.new(name.sub(/blue$/, 'green'))
  end
end