easy_flow 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecb99b16819c39ee6779f505087103685f5451955584173180cee6a134ba99d7
4
- data.tar.gz: 4c88735a46f9e295546aa10b7f88af016e306f55d4157e1f92f9b86de7efa9c8
3
+ metadata.gz: '09da0c518d71ed06c4d63399b2038696d15c770ee0706926bad55f81a3a58a34'
4
+ data.tar.gz: 68642f79f5418b7db09b3a7274948f8480f7519ca4224546b23bdb94e6e7db0d
5
5
  SHA512:
6
- metadata.gz: bfbff203e5039e389a78a1efc0fe3a7851ac06342ea231a8f58f8fc119f65abcf223d7a03fd3af399749e58daed91cb709dcb18e3d4fdba10cf89f79c81b5e4e
7
- data.tar.gz: 69c08d5dec817a6c8105c37e59e4fa953252c78a5dad1c53ece0d072397297beb6d2ce273eeb2e4fe50c9ecfef18d634e0b361b1b33cc287376ca594745065d7
6
+ metadata.gz: 2ae172d8e8851e18042c80217e2163f1e4b3cf829f556c2936ee41f353340b05eea8225d0fc3cd412186adb9c662f36380cbca51b1ef259455ea44e1ea5467f6
7
+ data.tar.gz: 5069ecd19aafa80210158466d6819233b1485bc6820f4d1f259ebcdb0c067b1fafa94ab72be84210d32acbc0c510d7e8c115cb303c0e304f17d87cbeb3587233
@@ -12,9 +12,16 @@ module EasyFlow
12
12
 
13
13
  helper_method :flow_start_path, :flow_routes
14
14
 
15
+ class_attribute :host_route_prefix, instance_accessor: false
16
+
17
+ def self.routed_by(prefix)
18
+ self.host_route_prefix = prefix
19
+ end
20
+
15
21
  private
16
22
 
17
23
  def flow_routes
24
+ return HostRoutes.new(main_app, self.class.host_route_prefix) if self.class.host_route_prefix
18
25
  return easy_flow unless request.routes.equal?(EasyFlow::Engine.routes)
19
26
 
20
27
  @flow_routes ||= ActionDispatch::Routing::RoutesProxy.new(_routes, self, _routes.url_helpers)
@@ -0,0 +1,14 @@
1
+ module EasyFlow
2
+ class HostRoutes
3
+ NAMES = %i[flow_path flow_runs_path flow_step_path run_path].freeze
4
+
5
+ def initialize(routes, prefix)
6
+ @routes = routes
7
+ @prefix = prefix
8
+ end
9
+
10
+ NAMES.each do |name|
11
+ define_method(name) { |*args, **options| @routes.public_send(:"#{@prefix}_#{name}", *args, **options) }
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module EasyFlow
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
data/lib/easy_flow.rb CHANGED
@@ -2,6 +2,7 @@ require "json"
2
2
  require "easy_flow/version"
3
3
  require "easy_flow/host"
4
4
  require "easy_flow/unset_host"
5
+ require "easy_flow/host_routes"
5
6
  require "easy_flow/engine"
6
7
 
7
8
  module EasyFlow
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider
@@ -137,6 +137,7 @@ files:
137
137
  - lib/easy_flow.rb
138
138
  - lib/easy_flow/engine.rb
139
139
  - lib/easy_flow/host.rb
140
+ - lib/easy_flow/host_routes.rb
140
141
  - lib/easy_flow/unset_host.rb
141
142
  - lib/easy_flow/version.rb
142
143
  homepage: https://github.com/DYB-Development/easy_flow