Class: StormForge::Dsl::TestCase::DataSource
- Inherits:
-
Object
- Object
- StormForge::Dsl::TestCase::DataSource
show all
- Defined in:
- lib/stormforge/dsl/test_case/data_source.rb
Defined Under Namespace
Classes: FileFixture, RandomNumber, RandomString
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(callable = nil, &block) ⇒ DataSource
Returns a new instance of DataSource.
15
16
17
18
19
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 15
def initialize(callable=nil, &block)
@data_sources = {}
instance_eval(&(callable || block))
end
|
Class Method Details
.build_marker(base_type, args) ⇒ Object
4
5
6
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 4
def build_marker(base_type, args)
"${#{base_type}|#{args_to_param(args)}}"
end
|
Instance Method Details
#file(name, options) ⇒ Object
29
30
31
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 29
def file(name, options)
@data_sources[name] = FileFixture.new(name, options)
end
|
#file_fixture_sources ⇒ Object
33
34
35
36
37
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 33
def file_fixture_sources
@data_sources.each_with_object({}) do |(name, source), memo|
memo[name] = source if source.instance_of? FileFixture
end
end
|
#random_number(name, options) ⇒ Object
25
26
27
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 25
def random_number(name, options)
@data_sources[name] = RandomNumber.new(name, options)
end
|
#random_string(name, options) ⇒ Object
21
22
23
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 21
def random_string(name, options)
@data_sources[name] = RandomString.new(name, options)
end
|
#serializable_hash(*args) ⇒ Object
43
44
45
46
47
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 43
def serializable_hash(*args)
@data_sources.each_with_object({}) do |(name, data_source), hash|
hash[name] = data_source
end
end
|
#sources ⇒ Object
39
40
41
|
# File 'lib/stormforge/dsl/test_case/data_source.rb', line 39
def sources
@data_sources
end
|