Class: ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Commands::SetFeatureStubbedEntry

Inherits:
Support::Command
  • Object
show all
Defined in:
lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/set_feature_stubbed_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Support::Command

[], call

Constructor Details

#initialize(feature:, entry:, arguments:, value:) ⇒ void

Parameters:



45
46
47
48
49
50
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/set_feature_stubbed_entry.rb', line 45

def initialize(feature:, entry:, arguments:, value:)
  @feature = feature
  @entry = entry
  @arguments = arguments
  @value = value
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



30
31
32
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/set_feature_stubbed_entry.rb', line 30

def arguments
  @arguments
end

#entryObject (readonly)

Returns the value of attribute entry.



24
25
26
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/set_feature_stubbed_entry.rb', line 24

def entry
  @entry
end

#featureObject (readonly)

Returns the value of attribute feature.



18
19
20
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/set_feature_stubbed_entry.rb', line 18

def feature
  @feature
end

#valueObject (readonly)

Returns the value of attribute value.



36
37
38
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/set_feature_stubbed_entry.rb', line 36

def value
  @value
end

Instance Method Details

#callObject

Returns Can be any type.

Returns:

  • (Object)

    Can be any type.



58
59
60
61
62
63
64
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/set_feature_stubbed_entry.rb', line 58

def call
  if arguments.nil?
    cache.default = value
  else
    cache.write(cache.keygen(*arguments.args, **arguments.kwargs, &arguments.block), value)
  end
end