Class: Shokkenki::Provider::Model::Fixture
- Inherits:
-
Object
- Object
- Shokkenki::Provider::Model::Fixture
- Defined in:
- lib/shokkenki/provider/model/fixture.rb
Instance Method Summary collapse
- #establish(required_fixture) ⇒ Object
-
#initialize(name_pattern, establisher) ⇒ Fixture
constructor
A new instance of Fixture.
- #matches?(required_fixture) ⇒ Boolean
- #name ⇒ Object
Constructor Details
#initialize(name_pattern, establisher) ⇒ Fixture
Returns a new instance of Fixture.
6 7 8 9 10 |
# File 'lib/shokkenki/provider/model/fixture.rb', line 6 def initialize name_pattern, establisher @name_pattern = name_pattern @establisher = establisher validate! end |
Instance Method Details
#establish(required_fixture) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/shokkenki/provider/model/fixture.rb', line 20 def establish required_fixture match = match(required_fixture) if match arguments = { :arguments => required_fixture.arguments, :match => match } @establisher.call arguments end end |
#matches?(required_fixture) ⇒ Boolean
16 17 18 |
# File 'lib/shokkenki/provider/model/fixture.rb', line 16 def matches? required_fixture !match(required_fixture).nil? end |
#name ⇒ Object
12 13 14 |
# File 'lib/shokkenki/provider/model/fixture.rb', line 12 def name @name_pattern.inspect end |