### Home Classes Methods

### In Files

- lib/v8/access/names.rb

### Methods

- #accessible_names
- #delete
- #get
- #names
- #query
- #set

### Files

- Makefile

### Class/Module Index

Quicksearch

- V8
- V8::Access
- V8::Access::Indices
- V8::Access::Invocation
- V8::Access::Invocation::Aritize
- V8::Access::Invocation::Method
- V8::Access::Invocation::Proc
- V8::Access::Invocation::UnboundMethod
- V8::Access::Names
- V8::Array
- V8::C
- V8::Conversion
- V8::Conversion::Accessor
- V8::Conversion::Array
- V8::Conversion::Class
- V8::Conversion::Code
- V8::Conversion::Code::InvocationHandler
- V8::Conversion::Constructor
- V8::Conversion::Constructor::Args
- V8::Conversion::Fixnum
- V8::Conversion::Fundamental
- V8::Conversion::Get
- V8::Conversion::Hash
- V8::Conversion::IGet
- V8::Conversion::ISet
- V8::Conversion::Identity
- V8::Conversion::Method
- V8::Conversion::Method::MethodCache
- V8::Conversion::NativeDate
- V8::Conversion::NativeObject
- V8::Conversion::NativeString
- V8::Conversion::Object
- V8::Conversion::Primitive
- V8::Conversion::Proc
- V8::Conversion::Reference
- V8::Conversion::Set
- V8::Conversion::String
- V8::Conversion::Symbol
- V8::Conversion::Time
- V8::Error
- V8::Error::Protect
- V8::Error::Try
- V8::Function
- V8::Object
- V8::StackFrame
- V8::StackTrace
- V8::Weak
- V8::Weak::Cell
- V8::Weak::Cell::Storage
- V8::Weak::Ref
- V8::Weak::WeakValueMap
- Object
- UnboundMethod

No matching classes.

# V8::Access::Names

### Public Instance Methods

accessible_names(obj, special_methods = false) click to toggle source

    # File lib/v8/access/names.rb, line 47
    def accessible_names(obj, special_methods = false)
      obj.public_methods(false).map {|m| m.to_s}.to_set.tap do |methods|
        ancestors = obj.class.ancestors.dup
        while ancestor = ancestors.shift
          break if ancestor == ::Object
          methods.merge(ancestor.public_instance_methods(false).map {|m| m.to_s})
        end
        methods.reject!(&special?) unless special_methods
      end
    end

delete(obj, name, &dontintercept) click to toggle source

    # File lib/v8/access/names.rb, line 43
    def delete(obj, name, &dontintercept)
      yield
    end

get(obj, name, &dontintercept) click to toggle source

    # File lib/v8/access/names.rb, line 8
    def get(obj, name, &dontintercept)
      methods = accessible_names(obj)
      if methods.include?(name)
        method = obj.method(name)
        method.arity == 0 ? method.call : method.unbind
      elsif obj.respond_to?(:[]) && !special?(name)
        obj.send(:[], name, &dontintercept)
      else
        yield
      end
    end

names(obj) click to toggle source

    # File lib/v8/access/names.rb, line 4
    def names(obj)
      accessible_names(obj)
    end

query(obj, name, attributes, &dontintercept) click to toggle source

    # File lib/v8/access/names.rb, line 32
    def query(obj, name, attributes, &dontintercept)
      if obj.respond_to?(name)
        attributes.dont_delete
        unless obj.respond_to?(name + "=")
          attributes.read_only
        end
      else
        yield
      end
    end

set(obj, name, value, &dontintercept) click to toggle source

    # File lib/v8/access/names.rb, line 20
    def set(obj, name, value, &dontintercept)
      setter = name + "="
      methods = accessible_names(obj, true)
      if methods.include?(setter)
        obj.send(setter, value)
      elsif obj.respond_to?(:[]=) && !special?(name)
        obj.send(:[]=, name, value, &dontintercept)
      else
        yield
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.