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.
39 40 41 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 39 def initialize(arguments:) @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
19 20 21 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 19 def arguments @arguments end |
Instance Method Details
#args ⇒ Array
24 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 24 delegate :args, to: :arguments |
#block ⇒ Proc
34 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 34 delegate :block, to: :arguments |
#call ⇒ String
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 46 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
29 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 29 delegate :kwargs, to: :arguments |
#printable_args ⇒ String
68 69 70 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 68 def printable_args args.map(&:inspect).join(", ") end |
#printable_block ⇒ String
82 83 84 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 82 def printable_block block ? Utils::Proc.display(block) : "" end |
#printable_kwargs ⇒ String
75 76 77 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb', line 75 def printable_kwargs kwargs.map { |key, value| "#{key}: #{value.inspect}" }.join(", ") end |