Module: Kernel

Defined in:
lib/ruby_run_js/helper.rb

Instance Method Summary collapse

Instance Method Details

#js_classObject



133
134
135
136
137
138
139
140
# File 'lib/ruby_run_js/helper.rb', line 133

def js_class
  return 'Undefined' if is_a?(RubyRunJs::JsUndefined)
  return 'Null' if is_a?(RubyRunJs::JsNull)
  return 'Boolean' if is_a?(TrueClass) || is_a?(FalseClass)
  return 'Number' if is_a?(Float)
  return 'String' if is_a?(String)
  self._class
end

#js_typeObject



122
123
124
125
126
127
128
129
130
131
# File 'lib/ruby_run_js/helper.rb', line 122

def js_type
  return :Undefined if is_a?(RubyRunJs::JsUndefined)
  return :Null if is_a?(RubyRunJs::JsNull)
  return :Boolean if is_a?(TrueClass) || is_a?(FalseClass)
  return :Number if is_a?(Float)
  return :String if is_a?(String)
  return :Object if is_a?(RubyRunJs::JsBaseObject)

  :Native
end

#nullObject



142
143
144
# File 'lib/ruby_run_js/helper.rb', line 142

def null
  RubyRunJs::JsNull.instance
end

#undefinedObject



146
147
148
# File 'lib/ruby_run_js/helper.rb', line 146

def undefined
  RubyRunJs::JsUndefined.instance
end