Class: ActiveDoc::Descriptions::MethodArgumentDescription::ArrayArgumentExpectation

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ArgumentExpectation

#additional_rdoc, find, #fulfilled?, inherited

Constructor Details

#initialize(argument) ⇒ ArrayArgumentExpectation

Returns a new instance of ArrayArgumentExpectation.



182
183
184
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 182

def initialize(argument)
  @array = argument
end

Class Method Details

.from(argument, options, proc) ⇒ Object



200
201
202
203
204
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 200

def self.from(argument, options, proc)
  if argument.is_a? Array
    self.new(argument)
  end
end

Instance Method Details

#condition?(value, args_with_vals) ⇒ Boolean

Returns:

  • (Boolean)


186
187
188
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 186

def condition?(value, args_with_vals)
  @array.include?(value)
end

#expectation_fail_to_sObject

Expected to… NOTE: Possible thread-safe problem



192
193
194
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 192

def expectation_fail_to_s
  "be included in #{@array.inspect}, got #{@failed_value.inspect}"
end

#to_rdocObject



196
197
198
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 196

def to_rdoc
  @array.inspect
end