scout-helpers 0.0.3 → 0.0.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmZlNjFhM2NkNDEyZTkwYmUwMDgzODU2NzJmNmY4M2FlYzA2MWFjOA==
4
+ Nzg5ZjY2MjhhYWIxOGEzNDM0ODNiZmU5Mjg3MGM5NzMzMTRkMDk5NA==
5
5
  data.tar.gz: !binary |-
6
- MWRiZjFhYzVjMGRhMjMxOWVkYWUzM2QzOGUwY2YzNDliNTNkZWQyOA==
6
+ MmZkY2Y2MGQ3M2Y4Zjk1Yjc2NmQyNjJkYmFhZDgyN2IwMWFjYzIzNQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MWZmNDI4NDk3Y2FjNTU4YjUzZjZmY2YyZmY1MWZkNzYzOWMyMWY1ZTI4Zjhl
10
- ODAzZjM3Yzk5NDM3M2JiMzRiODU5MDVhYmIxZWZmZDI4MTM4MGI0ZDQxYzA5
11
- NTIwMzRjMjA3NzI2YzFjYmUxMzljZDIzODg1ODAzYjM4NzI4Nzg=
9
+ NjYxOGI3YTI0NGIwODk3ZTBjNDVkZGU3MTgzOTU5MTJlNDg4NjM1OGJhYTQz
10
+ OWNhYjc4ZDUzZGEyNTEyNTI1NzgzYzk5ZDM1YTE1YmE3ODg3ODdjMTViMDFl
11
+ ZDA3MmRkODNlMjA1M2UxZDY4MDEwMjgxMGI0MGRkYTdjMWZlMmM=
12
12
  data.tar.gz: !binary |-
13
- NTk5M2UxOTcwODNkM2RjYzU5N2JjM2FlNDNmMzkzY2M5OTZlM2U3YmYwNDcw
14
- ZmZkZTlkMDUxZmE3MWExY2M5MmM2YWU3MjY1MTIxYzhiMTAxY2UxMjRhOTc5
15
- MDk1Y2ZiNTMwOGI5MWNlMWFjNWZjMmNmOTFiODM0NjcwZGZjODM=
13
+ OTUyNWQwZTA3YzA1MTY5MWM5MTE5ZDIxZmRiNTBiMDAwZWY1NWU5ZWNlMDZm
14
+ ZDJhY2Y3ZTc0ZGY4ZTIzZGQ3ZjIwYTYwODhjZDkwMTA3MmQzZjZkMTRlOGJi
15
+ Y2JkYTAyNThkNTQ4MjlhMmM2ZjFkODFkMDBkNzdkYWFkZDQ0MWU=
@@ -1,3 +1,3 @@
1
1
  module ScoutHelpers
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/scout-helpers.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  require "scout-helpers/version"
2
2
 
3
3
  module ScoutHelpers
4
- # returns file for a category
4
+ # returns current file for a category
5
5
  #
6
- def self.get_file(path, category)
6
+ def self.get_current_file(path, category)
7
7
  path = path.slice(0, path.size - 1) if path.end_with?('/')
8
8
  File.new(
9
9
  "#{path}/#{category}/" +
@@ -11,6 +11,21 @@ module ScoutHelpers
11
11
  .select {|item| item.match(category)}
12
12
  .reject {|item| item.match("#{category}_current")}
13
13
  .sort
14
- .last)
14
+ .last
15
+ )
15
16
  end
17
+
18
+ # returns last complete file for a category
19
+ #
20
+ def self.get_last_file(path, category)
21
+ path = path.slice(0, path.size - 1) if path.end_with?('/')
22
+ File.new(
23
+ "#{path}/#{category}/" +
24
+ Dir.entries("#{path}/#{category}")
25
+ .select {|item| item.match(category)}
26
+ .reject {|item| item.match("#{category}_current")}
27
+ .sort
28
+ .last(2)
29
+ .first
30
+ )
16
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tucker Joseph
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-10 00:00:00.000000000 Z
11
+ date: 2013-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler