Class: Qdocs::Base::Const
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(original_input) ⇒ Const
constructor
A new instance of Const.
- #show(const) {|constant| ... } ⇒ Object
Methods included from Helpers
#find_constant, #own_methods, #params_to_hash, #render_response, #source_location_to_str
Constructor Details
#initialize(original_input) ⇒ Const
Returns a new instance of Const.
72 73 74 |
# File 'lib/qdocs.rb', line 72 def initialize(original_input) @original_input = original_input end |
Instance Method Details
#show(const) {|constant| ... } ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/qdocs.rb', line 76 def show(const) const = const.to_s constant = find_constant const yield constant if block_given? const_sl = Object.const_source_location const if constant.instance_of?(Class) || constant.instance_of?(Module) render_response(constant, :constant, { source_location: source_location_to_str(const_sl), instance_methods: own_methods(constant.instance_methods).sort, singleton_methods: own_methods(constant.methods).sort, included_modules: constant.included_modules, constants: constant.constants, constant_type: constant.class.name, inheritance_chain: build_inheritance_chain(constant).map(&:name), }) else render_response(constant, :constant, { source_location: source_location_to_str(const_sl), instance_methods: nil, singleton_methods: nil, included_modules: nil, constants: nil, value: constant, constant_type: constant.class.name, inheritance_chain: nil, }) end end |