Class: Dryer::Clients::ApiDescriptions::Resources::GenerateName

Inherits:
Services::SimpleService
  • Object
show all
Defined in:
lib/dryer/clients/api_descriptions/resources/generate_name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ GenerateName

Returns a new instance of GenerateName.


8
9
10
# File 'lib/dryer/clients/api_descriptions/resources/generate_name.rb', line 8

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.


20
21
22
# File 'lib/dryer/clients/api_descriptions/resources/generate_name.rb', line 20

def resource
  @resource
end

Instance Method Details

#callObject


12
13
14
15
16
17
18
# File 'lib/dryer/clients/api_descriptions/resources/generate_name.rb', line 12

def call
  resource[:url]
    .split("/")
    .reject { |part| part.start_with?(":") }
    .reject { |part| part.empty? }
    .join("_")
end