Class: Fixtures::Example
- Inherits:
-
Object
- Object
- Fixtures::Example
- Extended by:
- T::Sig
- Defined in:
- lib/data_model/fixtures/example.rb
Instance Method Summary collapse
- #[](type) ⇒ Object
-
#initialize(schema, variants:) ⇒ Example
constructor
A new instance of Example.
- #model ⇒ Object
Constructor Details
#initialize(schema, variants:) ⇒ Example
Returns a new instance of Example.
8 9 10 11 |
# File 'lib/data_model/fixtures/example.rb', line 8 def initialize(schema, variants:) @schema = schema @variants = variants end |
Instance Method Details
#[](type) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/data_model/fixtures/example.rb', line 19 def [](type) if !@variants.key?(type) raise "#{type} is not a defined variant: #{@variants}" end result = @variants.fetch(type) return [model, result] end |