Class: CaseBase

Inherits:
Object
  • Object
show all
Includes:
CommandServiceObject::CheckHelper, CommandServiceObject::FailureHelper, CommandServiceObject::Hooks
Defined in:
lib/generators/service/install/templates/services/case_base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommandServiceObject::CheckHelper

#check!

Methods included from CommandServiceObject::FailureHelper

#fail!

Methods included from CommandServiceObject::Hooks

included

Constructor Details

#initialize(cmd) ⇒ CaseBase

Returns a new instance of CaseBase.



13
14
15
16
17
# File 'lib/generators/service/install/templates/services/case_base.rb', line 13

def initialize(cmd)
  @cmd = cmd
  @issuer = cmd.try(:issuer)
  @right_name = "#{service_name}.#{case_name}"
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



10
11
12
# File 'lib/generators/service/install/templates/services/case_base.rb', line 10

def cmd
  @cmd
end

#issuerObject (readonly)

Returns the value of attribute issuer.



10
11
12
# File 'lib/generators/service/install/templates/services/case_base.rb', line 10

def issuer
  @issuer
end

#right_nameObject (readonly)

Returns the value of attribute right_name.



10
11
12
# File 'lib/generators/service/install/templates/services/case_base.rb', line 10

def right_name
  @right_name
end

Instance Method Details

#allowed?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/generators/service/install/templates/services/case_base.rb', line 27

def allowed?
  true
end

#case_nameObject



19
20
21
# File 'lib/generators/service/install/templates/services/case_base.rb', line 19

def case_name
  self.class.name.split('::').last.downcase
end

#rollbackObject



31
# File 'lib/generators/service/install/templates/services/case_base.rb', line 31

def rollback; end

#service_nameObject



23
24
25
# File 'lib/generators/service/install/templates/services/case_base.rb', line 23

def service_name
  self.class.name.split('::').first.remove('Service').downcase
end