Module: MethodReflect::MethodExtensions
- Included in:
- Method, Proc, UnboundMethod
- Defined in:
- lib/method_reflect.rb
Instance Method Summary collapse
- #code_object ⇒ Object
- #commented_source ⇒ Object
- #docstring ⇒ Object
- #docstring_summary ⇒ Object
- #docstring_tags ⇒ Object
- #parameter_defaults ⇒ Object
- #scope ⇒ Object
- #signature ⇒ Object
- #visibility ⇒ Object
Instance Method Details
#code_object ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/method_reflect.rb', line 14 def code_object if @code_object == nil YARD::Registry.clear YARD::parse_string(commented_source) @code_object = YARD::Registry.first end @code_object end |
#commented_source ⇒ Object
7 8 9 10 11 12 |
# File 'lib/method_reflect.rb', line 7 def commented_source if @commented_source == nil @commented_source = self.comment + self.source end @commented_source end |
#docstring ⇒ Object
23 24 25 26 27 28 |
# File 'lib/method_reflect.rb', line 23 def docstring if @docstring == nil @docstring = code_object.docstring end @docstring end |
#docstring_summary ⇒ Object
30 31 32 33 34 35 |
# File 'lib/method_reflect.rb', line 30 def docstring_summary if @docstring_summary == nil @docstring_summary = code_object.docstring.summary end @docstring_summary end |
#docstring_tags ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/method_reflect.rb', line 37 def if @docstring_tags == nil @docstring_tags = docstring..map { |t| {name: t.name, tag_name: t.tag_name, text: t.text, types: t.types} } end @docstring_tags end |
#parameter_defaults ⇒ Object
53 54 55 56 57 58 |
# File 'lib/method_reflect.rb', line 53 def parameter_defaults if @parameter_defaults == nil @parameter_defaults = code_object.parameters.map{|n,d| [n.to_sym, d]} end @parameter_defaults end |
#scope ⇒ Object
67 68 69 70 71 72 |
# File 'lib/method_reflect.rb', line 67 def scope if @scope == nil @scope = code_object.scope end @scope end |
#signature ⇒ Object
46 47 48 49 50 51 |
# File 'lib/method_reflect.rb', line 46 def signature if @signature == nil @signature = code_object.signature end @signature end |
#visibility ⇒ Object
60 61 62 63 64 65 |
# File 'lib/method_reflect.rb', line 60 def visibility if @visibility == nil @visibility = code_object.visibility end @visibility end |