Class: ApiMaker::IncludeHelpers

Inherits:
ApplicationService show all
Defined in:
app/services/api_maker/include_helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationService

#api_maker_json

Constructor Details

#initialize(klass:) ⇒ IncludeHelpers

Returns a new instance of IncludeHelpers.



6
7
8
# File 'app/services/api_maker/include_helpers.rb', line 6

def initialize(klass:)
  @klass = klass
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



4
5
6
# File 'app/services/api_maker/include_helpers.rb', line 4

def klass
  @klass
end

Instance Method Details

#performObject



10
11
12
13
14
15
16
# File 'app/services/api_maker/include_helpers.rb', line 10

def perform
  ::ApiHelpers.constants(false).each do |constant|
    klass.include ApiHelpers.const_get(constant)
  end

  succeed!
end