Module: Sevgi::Graphics::Mixtures::Replicate::Ensure

Extended by:
Ensure
Included in:
Ensure
Defined in:
lib/sevgi/graphics/mixtures/replicate.rb

Constant Summary collapse

ASSERTION =
{
  symbol: proc { |name, value| "Argument '#{name}' must be a string"           unless value.is_a?(::String)  },
  n:      proc { |name, value| "Argument '#{name}' must be a positive integer" unless value.positive?        },
  nx:     proc { |name, value| "Argument '#{name}' must be a positive integer" unless value.positive?        },
  ny:     proc { |name, value| "Argument '#{name}' must be a positive integer" unless value.positive?        },
  d:      proc { |name, value| "Argument '#{name}' must be a number"           unless value.is_a?(::Numeric) },
  dx:     proc { |name, value| "Argument '#{name}' must be a number"           unless value.is_a?(::Numeric) },
  dy:     proc { |name, value| "Argument '#{name}' must be a number"           unless value.is_a?(::Numeric) }
}.freeze

Instance Method Summary collapse

Instance Method Details

#with_block(block) ⇒ Object



92
93
94
95
96
# File 'lib/sevgi/graphics/mixtures/replicate.rb', line 92

def with_block(block, **)
  ArgumentError.("Block required") unless block

  call(**)
end

#without_block(block) ⇒ Object



98
99
100
101
102
# File 'lib/sevgi/graphics/mixtures/replicate.rb', line 98

def without_block(block, **)
  ArgumentError.("Block not allowed") if block

  call(**)
end