lib/veritas/function/numeric/unary_minus.rb in veritas-0.0.6 vs lib/veritas/function/numeric/unary_minus.rb in veritas-0.0.7
- old
+ new
@@ -6,22 +6,20 @@
# A class representing a unary minus function
class UnaryMinus < Numeric
include Unary
- # Return the value subtracted from 0
+ # Return the unary minus operation
#
# @example
- # negated_value = UnaryMinus.call(value)
+ # UnaryMinus.operation # => :-@
#
- # @param [Numeric] value
+ # @return [Symbol]
#
- # @return [Numeric]
- #
# @api public
- def self.call(value)
- -value
+ def self.operation
+ :-@
end
# Return the inverse function class
#
# @example
@@ -30,21 +28,9 @@
# @return [Class<UnaryPlus>]
#
# @api public
def self.inverse
UnaryPlus
- end
-
- # Return a string representing the unary minus function
- #
- # @example
- # unary_minus.inspect # => "-1"
- #
- # @return [String]
- #
- # @api public
- def inspect
- "-(#{operand.inspect})"
end
module Methods
extend Aliasable