Class: ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatchers::Arguments::Commands::GeneratePrintableArguments
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::RSpec::PrimitiveMatchers::Classes::DelegateTo::Entities::SubMatchers::Arguments::Commands::GeneratePrintableArguments
- Includes:
- Support::Delegate
- Defined in:
- lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
Instance Method Summary collapse
- #args ⇒ Array
- #block ⇒ Proc
- #call ⇒ String
-
#initialize(arguments:) ⇒ GeneratePrintableArguments
constructor
A new instance of GeneratePrintableArguments.
- #kwargs ⇒ Hash
- #printable_args ⇒ String
- #printable_block ⇒ String
- #printable_kwargs ⇒ String
Methods included from Support::Delegate::ClassMethodsForForwardable
Methods inherited from Support::Command
Constructor Details
#initialize(arguments:) ⇒ GeneratePrintableArguments
Returns a new instance of GeneratePrintableArguments.
44 45 46 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 44 def initialize(arguments:) @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
24 25 26 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 24 def arguments @arguments end |
Instance Method Details
#args ⇒ Array
29 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 29 delegate :args, to: :arguments |
#block ⇒ Proc
39 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 39 delegate :block, to: :arguments |
#call ⇒ String
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 51 def call return "" if arguments.null_arguments? text = if args.any? && kwargs.any? "(#{printable_args}, #{printable_kwargs})" elsif args.any? "(#{printable_args})" elsif kwargs.any? "(#{printable_kwargs})" else "()" end text += " #{printable_block}" if block text end |
#kwargs ⇒ Hash
34 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 34 delegate :kwargs, to: :arguments |
#printable_args ⇒ String
73 74 75 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 73 def printable_args args.map(&:inspect).join(", ") end |
#printable_block ⇒ String
87 88 89 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 87 def printable_block block ? Utils::Proc.display(block) : "" end |
#printable_kwargs ⇒ String
80 81 82 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 80 def printable_kwargs kwargs.map { |key, value| "#{key}: #{value.inspect}" }.join(", ") end |