Class: WithClues::Private::CustomClueMethodAnalysis::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/with_clues/private/custom_clue_method_analysis.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


53
54
55
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 53

def keyword_required?
  @type == :keyreq
end

#nameObject



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

Returns:

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

Returns:

  • (Boolean)


50
51
52
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 50

def required?
  @type == :req
end

#to_sObject



67
68
69
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 67

def to_s
  "#<#{self.class} #{name}/#{@type}"
end