Sha256: 7e1a65bfb04d4e26366a4052d05eed25ed7e9042e8252b835b6838b7ff2da714
Contents?: true
Size: 1.61 KB
Versions: 14
Compression:
Stored size: 1.61 KB
Contents
module Inch module CodeObject module Provider module YARD # CodeObject::Provider::YARD::Object object represent code objects. # module Object class << self # Returns a Proxy object for the given +yard_object+ # # @param yard_object [YARD::CodeObject] # @return [Provider::YARD::Object] def for(yard_object) @cache ||= {} if proxy_object = @cache[cache_key(yard_object)] proxy_object else @cache[cache_key(yard_object)] = class_for(yard_object).new(yard_object) end end private # Returns a Proxy class for the given +yard_object+ # # @param yard_object [YARD::CodeObject] # @return [Class] def class_for(yard_object) class_name = yard_object.class.to_s.split('::').last const_get(class_name) rescue NameError Base end # Returns a cache key for the given +yard_object+ # # @param yard_object [YARD::CodeObject] # @return [String] def cache_key(yard_object) yard_object.path end end end end end end end require_relative 'object/base' require_relative 'object/namespace_object' require_relative 'object/class_object' require_relative 'object/constant_object' require_relative 'object/method_object' require_relative 'object/method_parameter_object' require_relative 'object/module_object'
Version data entries
14 entries across 14 versions & 1 rubygems