Class: Proxy::Dynflow
- Inherits:
-
Object
show all
- Defined in:
- lib/smart_proxy_dynflow/api.rb,
lib/smart_proxy_dynflow/plugin.rb,
lib/smart_proxy_dynflow/helpers.rb,
lib/smart_proxy_dynflow/testing.rb,
lib/smart_proxy_dynflow/version.rb,
lib/smart_proxy_dynflow/callback.rb,
lib/smart_proxy_dynflow.rb
Defined Under Namespace
Modules: Callback, Helpers, Testing
Classes: Api, Plugin
Constant Summary
collapse
- VERSION =
'0.0.4'
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Dynflow.
11
12
13
|
# File 'lib/smart_proxy_dynflow.rb', line 11
def initialize
@world = create_world
end
|
Class Attribute Details
.instance ⇒ Object
Returns the value of attribute instance.
42
43
44
|
# File 'lib/smart_proxy_dynflow.rb', line 42
def instance
@instance
end
|
Instance Attribute Details
#world ⇒ Object
Returns the value of attribute world.
9
10
11
|
# File 'lib/smart_proxy_dynflow.rb', line 9
def world
@world
end
|
Class Method Details
.after_initialize(&block) ⇒ Object
69
70
71
|
# File 'lib/smart_proxy_dynflow.rb', line 69
def after_initialize(&block)
after_initialize_blocks << block
end
|
.ensure_initialized ⇒ Object
44
45
46
47
48
49
|
# File 'lib/smart_proxy_dynflow.rb', line 44
def ensure_initialized
return @instance if @instance
@instance = Proxy::Dynflow.new
after_initialize_blocks.each(&:call)
@instance
end
|
.web_console ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/smart_proxy_dynflow.rb', line 51
def web_console
require 'dynflow/web'
dynflow_console = ::Dynflow::Web.setup do
Proxy::Dynflow.ensure_initialized
set :world, Proxy::Dynflow.world
end
dynflow_console
end
|
.world ⇒ Object
65
66
67
|
# File 'lib/smart_proxy_dynflow.rb', line 65
def world
instance.world
end
|
Instance Method Details
#create_world(&block) ⇒ Object
15
16
17
18
|
# File 'lib/smart_proxy_dynflow.rb', line 15
def create_world(&block)
config = default_world_config(&block)
::Dynflow::World.new(config)
end
|
#default_world_config ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/smart_proxy_dynflow.rb', line 28
def default_world_config
::Dynflow::Config.new.tap do |config|
config.auto_rescue = true
config.logger_adapter = logger_adapter
config.persistence_adapter = persistence_adapter
yield config if block_given?
end
end
|
#logger_adapter ⇒ Object
37
38
39
|
# File 'lib/smart_proxy_dynflow.rb', line 37
def logger_adapter
::Dynflow::LoggerAdapters::Simple.new $stderr, 0
end
|
#persistence_adapter ⇒ Object
24
25
26
|
# File 'lib/smart_proxy_dynflow.rb', line 24
def persistence_adapter
::Dynflow::PersistenceAdapters::Sequel.new persistence_conn_string
end
|
#persistence_conn_string ⇒ Object
20
21
22
|
# File 'lib/smart_proxy_dynflow.rb', line 20
def persistence_conn_string
ENV['DYNFLOW_DB_CONN_STRING'] || 'sqlite:/'
end
|