Class: Rubycli::Runner::ConstantCandidate
- Inherits:
-
Struct
- Object
- Struct
- Rubycli::Runner::ConstantCandidate
- Defined in:
- lib/rubycli/runner.rb
Instance Attribute Summary collapse
-
#class_methods ⇒ Object
Returns the value of attribute class_methods.
-
#constant ⇒ Object
Returns the value of attribute constant.
-
#instance_methods ⇒ Object
Returns the value of attribute instance_methods.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #callable?(instantiate: false) ⇒ Boolean
- #instance_only? ⇒ Boolean
- #matches?(base_name) ⇒ Boolean
- #summary ⇒ Object
Instance Attribute Details
#class_methods ⇒ Object
Returns the value of attribute class_methods
10 11 12 |
# File 'lib/rubycli/runner.rb', line 10 def class_methods @class_methods end |
#constant ⇒ Object
Returns the value of attribute constant
10 11 12 |
# File 'lib/rubycli/runner.rb', line 10 def constant @constant end |
#instance_methods ⇒ Object
Returns the value of attribute instance_methods
10 11 12 |
# File 'lib/rubycli/runner.rb', line 10 def instance_methods @instance_methods end |
#name ⇒ Object
Returns the value of attribute name
10 11 12 |
# File 'lib/rubycli/runner.rb', line 10 def name @name end |
Instance Method Details
#callable?(instantiate: false) ⇒ Boolean
17 18 19 20 21 |
# File 'lib/rubycli/runner.rb', line 17 def callable?(instantiate: false) return true if class_methods.any? instantiate && instance_methods.any? end |
#instance_only? ⇒ Boolean
27 28 29 |
# File 'lib/rubycli/runner.rb', line 27 def instance_only? instance_methods.any? && class_methods.empty? end |
#matches?(base_name) ⇒ Boolean
23 24 25 |
# File 'lib/rubycli/runner.rb', line 23 def matches?(base_name) name.split('::').last == base_name end |
#summary ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/rubycli/runner.rb', line 31 def summary parts = [] parts << "class: #{format_methods(class_methods)}" if class_methods.any? parts << "instance: #{format_methods(instance_methods)}" if instance_methods.any? parts << 'no CLI methods' if parts.empty? parts.join(' | ') end |