display_case 0.1.1 → 0.1.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: d8d1144510cef153b0d10d8657f431f8fc640c31
4
- data.tar.gz: 20a134bce8da4d671e6e4b4868bb9e3cbac98d0a
3
+ metadata.gz: 8309a666cba84ff544fb5cf9d97914bc228b8780
4
+ data.tar.gz: 821fe5d1b63f8fef408206a0d9bfe31c46c89a33
5
5
  SHA512:
6
- metadata.gz: 1b3e34382581c183fd291f616f63e3bf9210065844b090ae8e82a88078dbce46c376e2740273d5d7b7fc0a3e081281dbecfd7e372bc412f60cf7b6c8695dbfa8
7
- data.tar.gz: c86743c255e25f5352104d4473e7984223aa14105a4b0eebffff559e9c47fd49fc3c743b8634162cdbf7a7e17496007dd495685b31dd28fad294ef3cf93b0f52
6
+ metadata.gz: 0615b6350ce33c59cd1c912769574502f06ed84d2957889a8c7c1682d0cc84a0bfffe6fbaa88fa849a2cee03784d872e58c71ae6b5f9c3fc7755b9141f520109
7
+ data.tar.gz: c8ea968c3df2d1fbef07c6e2f1b95b8af0fdaa1eb54252b3315f23c1295a74a238d8c9adf91edd275cdf78f667bf46115411422281b241110129324a2789241f
@@ -4,13 +4,23 @@ module DisplayCase
4
4
  absolute_definition_file_paths = configuration.definition_file_paths.map {|path| File.expand_path(path) }
5
5
 
6
6
  absolute_definition_file_paths.uniq.each do |path|
7
- load("#{path}.rb") if File.exists?("#{path}.rb")
7
+ file = "#{path}.rb"
8
+ display_case_load file
8
9
 
9
10
  if File.directory? path
10
11
  Dir[File.join(path, '**', '*.rb')].sort.each do |file|
11
- load file
12
+ display_case_load file
12
13
  end
13
14
  end
14
15
  end
15
16
  end
17
+
18
+ private
19
+ def self.display_case_load(file)
20
+ @file_changes ||= {}
21
+ if File.exists?(file) && (@file_changes[file].to_i < (mtime = File.mtime(file).to_i))
22
+ load file
23
+ @file_changes[file] = mtime
24
+ end
25
+ end
16
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: display_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avdi Grimm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-10 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An implementation of the Exhibit pattern, as described in Objects on
14
14
  Rails