Module: Service::Helper

Extended by:
Helper
Included in:
Helper
Defined in:
lib/generators/service/helper.rb

Instance Method Summary collapse

Instance Method Details

#service_name(arg) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/generators/service/helper.rb', line 5

def service_name(arg)
  if arg.include? "/"
    root = arg.split("/").first
    sub_domain = arg.split("/").last
    "#{root.underscore}_service/#{sub_domain}"
  else
    "#{arg.underscore}_service"
  end
end

#service_path(arg) ⇒ Object



15
16
17
# File 'lib/generators/service/helper.rb', line 15

def service_path(arg)
  "app/services/#{service_name(arg)}"
end

#spec_path(arg) ⇒ Object



19
20
21
# File 'lib/generators/service/helper.rb', line 19

def spec_path(arg)
  "spec/services/#{service_name(arg)}"
end