Class: ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Commands::DefineMethodInContainer

Inherits:
ConvenientService::Support::Command show all
Includes:
ConvenientService::Support::Delegate
Defined in:
lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConvenientService::Support::Delegate::ClassMethodsForForwardable

#delegate

Methods inherited from ConvenientService::Support::Command

[], call

Constructor Details

#initialize(method:, container:, index:) ⇒ void



47
48
49
50
51
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 47

def initialize(method:, container:, index:)
  @method = method
  @container = container
  @index = index
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



23
24
25
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 23

def container
  @container
end

#indexObject (readonly)

Returns the value of attribute index.



29
30
31
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 29

def index
  @index
end

#methodObject (readonly)

Returns the value of attribute method.



17
18
19
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 17

def method
  @method
end

Instance Method Details

#callBoolean

Returns true if method is just defined, false if already defined.

Returns:

  • (Boolean)

    true if method is just defined, false if already defined.



56
57
58
59
60
61
62
63
64
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 56

def call
  container.mutex.synchronize do
    return false if has_defined_method?

    define_method

    true
  end
end

#keyConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Key



34
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 34

delegate :key, to: :method

#nameConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Name



39
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 39

delegate :name, to: :method