Class: Contracts::IsA
- Defined in:
- lib/middleman-core/contracts.rb,
lib/middleman-core/contracts.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(val) ⇒ IsA
constructor
A new instance of IsA.
- #valid?(val) ⇒ Boolean
Constructor Details
#initialize(val) ⇒ IsA
Returns a new instance of IsA.
12 13 14 |
# File 'lib/middleman-core/contracts.rb', line 12 def initialize(val) @val = val end |
Class Method Details
.[](val) ⇒ Object
7 8 9 10 |
# File 'lib/middleman-core/contracts.rb', line 7 def self.[](val) @lookup ||= {} @lookup[val] ||= new(val) end |
Instance Method Details
#valid?(val) ⇒ Boolean
16 17 18 |
# File 'lib/middleman-core/contracts.rb', line 16 def valid?(val) val.is_a? @val.constantize end |