Parent

Class Index [+]

Quicksearch

RKelly::JS::Base

Attributes

properties[R]

(Not documented)

return[R]

(Not documented)

value[R]

(Not documented)

Public Class Methods

new() click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 5
      def initialize
        @properties = Hash.new { |h,k|
          h[k] = Property.new(k, :undefined, self)
        }
        @return     = nil
        @returned   = false
        @value      = self
        self['Class'] = self.class.to_s.split('::').last
      end

Public Instance Methods

[](name) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 15
      def [](name)
        return self.properties[name] if has_property?(name)
        if self.properties['prototype'].value != :undefined
          self.properties['prototype'].value[name]
        else
          RKelly::Runtime::UNDEFINED
        end
      end
[]=(name, value) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 24
      def []=(name, value)
        return unless can_put?(name)
        if has_property?(name)
          self.properties[name].value = value
        else
          self.properties[name] = Property.new(name, value, self)
        end
      end
can_put?(name) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 33
      def can_put?(name)
        if !has_property?(name)
          return true if self.properties['prototype'].nil?
          return true if self.properties['prototype'].value.nil?
          return true if self.properties['prototype'].value == :undefined
          return self.properties['prototype'].value.can_put?(name)
        end
        !self.properties[name].read_only?
      end
default_value(hint) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 58
      def default_value(hint)
        case hint
        when 'Number'
          value_of = self['valueOf']
          if value_of.function || value_of.value.is_a?(RKelly::JS::Function)
            return value_of
          end
          to_string = self['toString']
          if to_string.function || to_string.value.is_a?(RKelly::JS::Function)
            return to_string
          end
        end
      end
delete(name) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 51
      def delete(name)
        return true unless has_property?(name)
        return false if self.properties[name].dont_delete?
        self.properties.delete(name)
        true
      end
has_property?(name) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 43
      def has_property?(name)
        return true if self.properties.has_key?(name)
        return false if self.properties['prototype'].nil?
        return false if self.properties['prototype'].value.nil?
        return false if self.properties['prototype'].value == :undefined
        self.properties['prototype'].value.has_property?(name)
      end
return(=(value)) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 72
      def return=(value)
        @returned = true
        @return = value
      end
returned?() click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 77
      def returned?; @returned; end

Private Instance Methods

unbound_method(name, object_id = nil, &block) click to toggle source

(Not documented)

# File lib/rkelly/js/base.rb, line 80
      def unbound_method(name, object_id = nil, &block)
        name = "#{name}_#{self.class.to_s.split('::').last}_#{object_id}"
        unless RKelly::JS::Base.instance_methods.include?(name.to_sym)
          RKelly::JS::Base.class_eval do
            define_method(name, &block)
          end
        end
        RKelly::JS::Base.instance_method(name)
      end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.