Class: WithClues::Private::CustomClueMethodAnalysis::Param
- Inherits:
-
Object
- Object
- WithClues::Private::CustomClueMethodAnalysis::Param
- Defined in:
- lib/with_clues/private/custom_clue_method_analysis.rb
Instance Method Summary collapse
-
#initialize(method_param_array) ⇒ Param
constructor
A new instance of Param.
- #keyword_required? ⇒ Boolean
- #name ⇒ Object
- #named?(*allowed_names) ⇒ Boolean
- #required? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(method_param_array) ⇒ Param
Returns a new instance of Param.
44 45 46 47 48 |
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 44 def initialize(method_param_array) @type = method_param_array[0] @name = method_param_array[1] end |
Instance Method Details
#keyword_required? ⇒ Boolean
53 54 55 |
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 53 def keyword_required? @type == :keyreq end |
#name ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 60 def name if self.keyword_required? "#{@name}:" else @name end end |
#named?(*allowed_names) ⇒ Boolean
57 58 59 |
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 57 def named?(*allowed_names) allowed_names.include?(@name) end |
#required? ⇒ Boolean
50 51 52 |
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 50 def required? @type == :req end |
#to_s ⇒ Object
67 68 69 |
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 67 def to_s "#<#{self.class} #{name}/#{@type}" end |