Class: ActiveDoc::Descriptions::MethodArgumentDescription::ArgumentExpectation

Inherits:
Object
  • Object
show all
Defined in:
lib/active_doc/descriptions/method_argument_description.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(argument, options, proc) ⇒ Object



104
105
106
107
108
109
110
111
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 104

def self.find(argument, options, proc)
  @possible_argument_expectations.each do |expectation|
    if suitable_expectation = expectation.from(argument, options, proc)
      return  suitable_expectation
    end
  end
  return nil
end

.inherited(subclass) ⇒ Object



99
100
101
102
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 99

def self.inherited(subclass)
  @possible_argument_expectations ||= []
  @possible_argument_expectations << subclass
end

Instance Method Details

#additional_rdocObject

to be inserted after argument description in rdoc



125
126
127
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 125

def additional_rdoc
  return nil
end

#fulfilled?(value, args_with_vals) ⇒ Boolean

Returns:

  • (Boolean)


114
115
116
117
118
119
120
121
122
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 114

def fulfilled?(value, args_with_vals)
  if self.condition?(value, args_with_vals)
    @failed_value = nil
    return true
  else
    @failed_value = value
    return false
  end
end