Class: RBelly::JS::String
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ String
constructor
A new instance of String.
Methods inherited from Base
#[], #[]=, #can_put?, #default_value, #delete, #has_property?, #returned?
Constructor Details
#initialize(value) ⇒ String
Returns a new instance of String.
10 11 12 13 14 15 16 17 18 |
# File 'lib/rbelly/js/string.rb', line 10 def initialize(value) super() self['valueOf'] = value self['valueOf'].function = lambda { value } self['toString'] = value self['fromCharCode'] = unbound_method(:fromCharCode) { |*args| args.map { |x| x.chr }.join } end |
Class Method Details
.create(*args) ⇒ Object
5 6 7 |
# File 'lib/rbelly/js/string.rb', line 5 def create(*args) self.new(args.first || '') end |