lib/dydx/helper.rb in dydx-0.0.9 vs lib/dydx/helper.rb in dydx-0.1.0
- old
+ new
@@ -37,15 +37,15 @@
def inverse_super_ope(operator)
inverse_ope(super_ope(operator))
end
def is_num?
- (is_a?(Num) || is_a?(Fixnum)) || (is_a?(Inverse) && x.is_num?)
+ (is_a?(Num) || is_a?(Fixnum) || is_a?(Float)) || (is_a?(Inverse) && x.is_num?)
end
def is_0?
- self == 0 || (is_a?(Num) && n == 0)
+ [0, 0.0].include?(self) || (is_a?(Num) && n.is_0?)
end
def is_1?
self == 1 || (is_a?(Num) && n == 1)
end
@@ -92,24 +92,9 @@
OP_SYM_STR.each do |operator_name, operator|
define_method("#{operator_name}?") do
is_a?(Formula) && (@operator == operator)
# is_a?(Inverse) && self.operator == operator
end
- end
-
- def to_str(sym)
- OP_SYM_STR.key(sym)
- end
-
- def str_to_sym(str)
- OP_SYM_STR[str]
- end
-
- def to_str_inv(operator)
- {
- subtrahend: :+,
- divisor: :*
- }.key(operator)
end
def rest(f_or_g)
([:f, :g] - [f_or_g]).first
end