truck 0.8.1 → 0.8.2

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
  SHA1:
3
- metadata.gz: b9163ddda9ad94d4bdb3142fde6704ac24c8fe2e
4
- data.tar.gz: 377e00cc27d4b0f6ea8ef1b0d3386c7ca7e9cc43
3
+ metadata.gz: 078fde6292a95915f76eeba0efec27a4398bb055
4
+ data.tar.gz: 205bd43d1d5391460de0c7b2f32499ee3c56e3e6
5
5
  SHA512:
6
- metadata.gz: a55de745877a006ec2722fb2c68741b6b41eb4f673122a42f6d457a42d2a6a8a4bca5640d487ef58c52ca22003a0745859c75e821611cde4ef7f7e22d0894611
7
- data.tar.gz: fd4ff258f9782f0ef11f665d0125fbac6ada1ef10f54286f87cfd39aa64d3b383a1e28cf99afd160f92bc21174991fbed12ddfd8bcbbf258a3a4503723851475
6
+ metadata.gz: ed4264626b8e609d7af67313d6ac08ebaa8ec58ea952e6414b43f06cb25e4eb4cfe99663547e0d8c676121cce41bd46c2451ad1d6a7a6a190dd3a459e9a2c9ca
7
+ data.tar.gz: a3dea32078bb7500694c4c5c21089851cfe7d07518d6c5ac78185c804f0c64c6b7f8957539f09bf4f8fc18029d836eb7481476e4c04eca1152403da9f679960c
@@ -3,10 +3,10 @@ module Truck
3
3
  attr :autoload_paths, :mod, :name, :root
4
4
 
5
5
  def initialize(name, parent: nil, root:, autoload_paths: ['.'])
6
- @mod = build_mod
7
6
  @name = name
8
- @root = Pathname(root) if root
7
+ @root = Pathname(root)
9
8
  @parent = parent
9
+ @mod = build_mod
10
10
  @autoload_paths = expand_autoload_paths autoload_paths
11
11
  end
12
12
 
@@ -65,7 +65,11 @@ module Truck
65
65
  end
66
66
 
67
67
  def build_mod
68
- Module.new
68
+ mod = Module.new
69
+ mod.singleton_class.class_exec root do |__root__|
70
+ define_method :root do __root__ ; end
71
+ end
72
+ mod
69
73
  end
70
74
 
71
75
  def expand_autoload_paths(paths)
@@ -1,3 +1,3 @@
1
1
  module Truck
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -92,6 +92,10 @@ class ContextTest < Minitest::Test
92
92
  assert_kind_of Module, mod
93
93
  assert_equal 'MultipleAutoloadPaths::B::BA', mod.name
94
94
  end
95
+
96
+ def test_root_defined_on_mod
97
+ assert_equal Pathname("/foo"), Foo.root
98
+ end
95
99
 
96
100
  private
97
101
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ntl