Class: Bake::Types::Any
- Inherits:
-
Object
- Object
- Bake::Types::Any
- Defined in:
- lib/bake/types/any.rb
Class Method Summary collapse
Instance Method Summary collapse
- #composite? ⇒ Boolean
-
#initialize(types) ⇒ Any
constructor
A new instance of Any.
- #parse(input) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(types) ⇒ Any
Returns a new instance of Any.
24 25 26 |
# File 'lib/bake/types/any.rb', line 24 def initialize(types) @types = types end |
Class Method Details
.parse(value) ⇒ Object
40 41 42 |
# File 'lib/bake/types/any.rb', line 40 def self.parse(value) value end |
Instance Method Details
#composite? ⇒ Boolean
28 29 30 |
# File 'lib/bake/types/any.rb', line 28 def composite? @types.any?{|type| type.composite?} end |
#parse(input) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/bake/types/any.rb', line 32 def parse(input) @types.each do |type| return type.parse(input) rescue # Ignore end end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/bake/types/any.rb', line 44 def to_s "any of #{@types.join(', ')}" end |