Sha256: edff96fde39ea58f0e7f139b64a4b7c6dc127bf83ee1ee2dcc653208936a5201
Contents?: true
Size: 830 Bytes
Versions: 5
Compression:
Stored size: 830 Bytes
Contents
require 'singleton' module H8 # The class representing undefined in javascript. Singleton # Note that H8::Undefined == false but is not FalseClass class UndefinedClass include Singleton def blank? true end def undefined? true end def empty? true end def present? false end def ! true end def == x x.is_a?(H8::UndefinedClass) || x == false end end # The constant representing 'undefined' value in Javascript # The proper use is to compare returned value res == H8::Undefined Undefined = UndefinedClass.instance # Convert javascript 'arguments' object to ruby array def arguments_to_a args res = Array.new(l=args.length) l.times { |n| res[n] = args[n] } res end module_function :arguments_to_a end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
h8-0.5.5 | lib/h8/tools.rb |
h8-0.5.4 | lib/h8/tools.rb |
h8-0.5.2 | lib/h8/tools.rb |
h8-0.5.1 | lib/h8/tools.rb |
h8-0.5.0 | lib/h8/tools.rb |