Module: Kernel

Defined in:
lib/tensorflow/extensions/boolean.rb

Instance Method Summary collapse

Instance Method Details

#Boolean(value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tensorflow/extensions/boolean.rb', line 4

def Boolean(value)
  # Rails converts true/false to 't' and 'f' in this case
  # because it does not have data dictionary information for
  # these fields and doesn't seem to be able to figure it
  # out from the query results.
  if not value
    false
  elsif value.to_s.match(/^(t|true|1|yes|y)$/i)
    true
  else
    false
  end
end