Sha256: c080a75ccb720c7d1253ceebb4a193281dd99433938db059ce2983692b94a8d4
Contents?: true
Size: 1.01 KB
Versions: 11
Compression:
Stored size: 1.01 KB
Contents
module EnumStateMachine module YARD module Handlers # Handles and processes nodes class Base < ::YARD::Handlers::Ruby::Base private # Extracts the value from the node as either a string or symbol def extract_node_name(ast) case ast.type when :symbol_literal ast.jump(:ident).source.to_sym when :string_literal ast.jump(:tstring_content).source else nil end end # Extracts the values from the node as either strings or symbols. # If the node isn't an array, it'll be converted to an array. def extract_node_names(ast, convert_to_array = true) if [nil, :array].include?(ast.type) ast.children.map {|child| extract_node_name(child)} else node_name = extract_node_name(ast) convert_to_array ? [node_name] : node_name end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems