module Fable::NativeFunctionOperations
Public Instance Methods
addition(x, y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 3 def addition(x, y) return x + y end
all(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 129 def all(x) x.all end
and(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 59 def and(x,y) if x.is_a?(InkList) return (x.size > 0 && y.size > 0) ? 1 : 0 else return (x != 0 && y != 0) ? 1 : 0 end end
ceiling(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 91 def ceiling(x) x.ceil.to_f end
count(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 141 def count(x) x.count end
divide(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 15 def divide(x,y) x / y end
equal(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 27 def equal(x,y) return (x == y) ? 1 : 0 end
float_value(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 99 def float_value(x) x.to_f end
floor(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 87 def floor(x) x.floor.to_f end
greater(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 31 def greater(x,y) return (x > y) ? 1 : 0 end
greater_than_or_equal(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 39 def greater_than_or_equal(x,y) return (x >= y) ? 1 : 0 end
has(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 103 def has(x,y) if x.is_a?(InkList) return x.contains?(y) ? 1 : 0 else return x.include?(y) ? 1 : 0 end end
has_not(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 111 def has_not(x,y) has_return = has(x,y) # Need to invert values if has_return == 0 return 1 else return 0 end end
int_value(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 95 def int_value(x) x.to_i end
intersection(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 121 def intersection(x,y) return x & y end
invert(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 125 def invert(x) x.inverse end
less(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 35 def less(x,y) return (x < y) ? 1 : 0 end
less_than_or_equal(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 43 def less_than_or_equal(x,y) return (x <= y) ? 1 : 0 end
list_max(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 137 def list_max(x) x.max_as_list end
list_min(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 133 def list_min(x) x.min_as_list end
max(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 75 def max(x,y) return [x,y].max end
min(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 79 def min(x,y) return [x,y].min end
modulo(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 19 def modulo(x,y) return x % y end
multiply(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 11 def multiply(x,y) return x * y end
negate(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 23 def negate(x) return -x end
not(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 51 def not(x) if x.is_a?(InkList) return (x.size == 0) ? 1 : 0 else return (x == 0) ? 1 : 0 end end
not_equal(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 47 def not_equal(x,y) return (x != y) ? 1 : 0 end
or(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 67 def or(x,y) if x.is_a?(InkList) return (x.size > 0 || y.size > 0) ? 1 : 0 else return (x != 0 || y != 0) ? 1 : 0 end end
pow(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 83 def pow(x,y) return x ** y end
subtraction(x,y)
click to toggle source
# File lib/fable/native_function_operations.rb, line 7 def subtraction(x,y) return x - y end
value_of_list(x)
click to toggle source
# File lib/fable/native_function_operations.rb, line 145 def value_of_list(x) x.max_item[1] end