Sha256: b983e2116bec806d2fb8ff0f6fd4f2a4d4e71750057bae2a25106770ff949c92
Contents?: true
Size: 2 KB
Versions: 5
Compression:
Stored size: 2 KB
Contents
module Inch module CodeObject # The Converter takes code object representations from a provider and # converts them into attributes hashes. # These attributes can then be used to initialize a CodeObject::Proxy. # # @see CodeObject::Proxy.for module Converter OBJECT_ATTRIBUTES = %w( name fullname files filename children_fullnames parent_fullname api_tag? attributes bang_name? constant? constructor? depth docstring getter? has_alias? has_children? has_code_example? has_doc? has_multiple_code_examples? has_unconsidered_tags? method? nodoc? namespace? overridden? overridden_method_fullname parameters private? private_api_tag? private_tag? protected? public? questioning_name? return_described? return_mentioned? return_typed? in_root? setter? source unconsidered_tag_count undocumented? visibility ).map(&:to_sym) PARAMETER_ATTRIBUTES = %w( name block? described? mentioned? splat? typed? wrongly_mentioned? ).map(&:to_sym) # Returns an attributes Hash for a given code object # # @param o [Provider::YARD::Object::Base] # @return [Hash] def self.to_hash(o) attributes = {} OBJECT_ATTRIBUTES.each do |name| if o.respond_to?(name) attributes[name] = o.public_send(name) end end attributes[:parameters] = o.parameters.map do |parameter| hash = {} PARAMETER_ATTRIBUTES.each do |pname| if parameter.respond_to?(pname) hash[pname] = parameter.public_send(pname) end end hash end attributes end end end end
Version data entries
5 entries across 5 versions & 1 rubygems