lib/axiom/function/numeric/square_root.rb in axiom-0.1.0 vs lib/axiom/function/numeric/square_root.rb in axiom-0.1.1
- old
+ new
@@ -22,10 +22,23 @@
# @api public
def self.call(value)
Math.sqrt(value)
end
+ # Return the type returned from #call
+ #
+ # @example
+ # type = Axiom::Function::Numeric::SquareRoot.type
+ # # => Axiom::Types::Float
+ #
+ # @return [Class<Types::Float>]
+ #
+ # @api public
+ def self.type
+ Types::Float
+ end
+
# Return the inverse function
#
# @example
# inverse = square_root.inverse
#
@@ -36,20 +49,23 @@
Exponentiation.new(operand, 2).memoize(:inverse, self)
end
# Return the type returned from #call
#
- # @return [Class<Attribute::Float>]
+ # @example
+ # type = square_root.type # => Axiom::Types::Float
#
+ # @return [Class<Types::Float>]
+ #
# @api public
def type
- Attribute::Float
+ self.class.type
end
module Methods
extend Aliasable
- inheritable_alias(:sqrt => :square_root)
+ inheritable_alias(sqrt: :square_root)
# Return a square root function
#
# @example
# square_root = attribute.square_root