예제 #1
0
            protected CallSite <Func <CallSite, RubyContext, object, Proc, object> > /*!*/ GetSite(string /*!*/ name)
            {
                CallSite <Func <CallSite, RubyContext, object, Proc, object> > result;

                lock (_siteCache) {
                    if (!_siteCache.TryGetValue(name, out result))
                    {
                        result = CallSite <Func <CallSite, RubyContext, object, Proc, object> > .Create(RubySites.InstanceCallAction(name, RubyCallSignature.WithBlock(0)));

                        _siteCache[name] = result;
                    }
                }
                return(result);
            }
예제 #2
0
            internal RubyPropertyDescriptor(string name, object testObject, Type componentType)
                : base(name, null)
            {
                _name          = name;
                _componentType = componentType;

                _getterSite = CallSite <Func <CallSite, RubyContext, object, object> > .Create(RubySites.InstanceCallAction(_name));

                _setterSite = CallSite <Func <CallSite, RubyContext, object, object, object> > .Create(RubySites.InstanceCallAction(_name + "="));

                try {
                    _propertyType = GetValue(testObject).GetType();
                } catch (Exception) {
                    _propertyType = typeof(object);
                }
            }