Class: Rubycli::Runner::ConstantCandidate

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubycli/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#class_methodsObject

Returns the value of attribute class_methods

Returns:

  • (Object)

    the current value of class_methods



10
11
12
# File 'lib/rubycli/runner.rb', line 10

def class_methods
  @class_methods
end

#constantObject

Returns the value of attribute constant

Returns:

  • (Object)

    the current value of constant



10
11
12
# File 'lib/rubycli/runner.rb', line 10

def constant
  @constant
end

#instance_methodsObject

Returns the value of attribute instance_methods

Returns:

  • (Object)

    the current value of instance_methods



10
11
12
# File 'lib/rubycli/runner.rb', line 10

def instance_methods
  @instance_methods
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



10
11
12
# File 'lib/rubycli/runner.rb', line 10

def name
  @name
end

Instance Method Details

#callable?(instantiate: false) ⇒ Boolean

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


23
24
25
# File 'lib/rubycli/runner.rb', line 23

def matches?(base_name)
  name.split('::').last == base_name
end

#summaryObject



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