Class: Nanoc::Core::ContractsSupport::EnabledContracts::Named

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

Instance Method Summary collapse

Methods inherited from AbstractContract

[]

Constructor Details

#initialize(name) ⇒ Named

Returns a new instance of Named.



48
49
50
# File 'lib/nanoc/core/contracts_support.rb', line 48

def initialize(name)
  @name = name
end

Instance Method Details

#inspectObject



56
57
58
# File 'lib/nanoc/core/contracts_support.rb', line 56

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

#valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/nanoc/core/contracts_support.rb', line 52

def valid?(val)
  val.is_a?(Kernel.const_get(@name))
end