Class: ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
- Inherits:
-
Object
- Object
- ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
- Defined in:
- lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb
Overview
Instance Attribute Summary collapse
- #value ⇒ Object readonly
Instance Method Summary collapse
- #==(other) ⇒ Boolean?
- #for(feature_class, entry_name, arguments) ⇒ ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
- #initialize(value:, feature_class: nil, entry_name: nil, arguments: nil) ⇒ void constructor
- #register(&block) ⇒ ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
- #unregister ⇒ ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
Constructor Details
#initialize(value:, feature_class: nil, entry_name: nil, arguments: nil) ⇒ void
27 28 29 30 31 32 |
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb', line 27 def initialize(value:, feature_class: nil, entry_name: nil, arguments: nil) @value = value @feature_class = feature_class @entry_name = entry_name @arguments = arguments end |
Instance Attribute Details
#value ⇒ Object (readonly)
18 19 20 |
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb', line 18 def value @value end |
Instance Method Details
#==(other) ⇒ Boolean?
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb', line 73 def ==(other) return unless other.instance_of?(self.class) return false if value != other.value return false if feature_class != other.feature_class return false if entry_name != other.entry_name return false if arguments != other.arguments true end |
#for(feature_class, entry_name, arguments) ⇒ ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
40 41 42 |
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb', line 40 def for(feature_class, entry_name, arguments) self.class.new(value: value, feature_class: feature_class, entry_name: entry_name, arguments: arguments) end |
#register(&block) ⇒ ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb', line 48 def register(&block) Commands::SetFeatureStubbedEntry[feature: feature_class, entry: entry_name, arguments: arguments, value: value] return self unless block begin yield ensure Commands::DeleteFeatureStubbedEntry[feature: feature_class, entry: entry_name, arguments: arguments] end end |
#unregister ⇒ ConvenientService::Feature::Plugins::CanHaveStubbedEntries::Entities::ValueMock
63 64 65 66 67 |
# File 'lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb', line 63 def unregister Commands::DeleteFeatureStubbedEntry[feature: feature_class, entry: entry_name, arguments: arguments] self end |