Class: Nanoc::Core::ContractsSupport::EnabledContracts::IterOf

Inherits:
AbstractContract
  • Object
show all
Defined in:
lib/nanoc/core/contracts_support.rb

Instance Method Summary collapse

Methods inherited from AbstractContract

[]

Constructor Details

#initialize(contract) ⇒ IterOf

Returns a new instance of IterOf.



62
63
64
# File 'lib/nanoc/core/contracts_support.rb', line 62

def initialize(contract)
  @contract = contract
end

Instance Method Details

#inspectObject



70
71
72
# File 'lib/nanoc/core/contracts_support.rb', line 70

def inspect
  "#{self.class}(#{@contract})"
end

#valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/nanoc/core/contracts_support.rb', line 66

def valid?(val)
  val.respond_to?(:each) && val.all? { |v| Contract.valid?(v, @contract) }
end