where_to 0.8.1 → 0.9.0

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
- NTZiOWZkMDY0YzVjYWRjMGUxZTNiZWQyNjVmNWU0MTFiMjQxMTRlYQ==
4
+ ZDgzZmEwODdiY2JjY2E2M2VkNjIyNWFkNGExYTNhYzQwYjNjNmQ0NA==
5
5
  data.tar.gz: !binary |-
6
- YjI3MGJkNDAxY2ZjZDFjY2I1ZDhiNGRhMmJjMzg1MzhlYjg3MzQ1Zg==
6
+ NDIwMzRjNjFkMGUxM2MwMDlhNWU1N2RkMTAzNWUxODEyNGRjZWJiZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWM5NzgyZGIzYThiNzA0NjFhODJjZGE2MGUwOWQ5MGMwNWQ1ZDhkMWJiZjAz
10
- MzdjZDNkNDJiMWQ3N2ZiNjAxNWNmYTdhYzJkMjNhNDgyZTYwMmYyMmY5YmZi
11
- OGViZTk4YzM2YTJiMjMyOWVhZDk0ZDBlMmY2YjhlZWU4NjRmZGQ=
9
+ M2I1NzAxZjQwMTdmYWRkMDgxOWQ1YjVkMzNiOTU5NzZmZmI3NmIwMTM4ZTc4
10
+ MTVlNmM4NzgzYjMzOTUxMTY0YjExZjYwYTIyY2M5ZGQ1MTUzZmVhNzZkYWNj
11
+ Y2JmNjFjNWI2OTU5N2ZmZTMzMDExNmUyMzY1NTc5MmQxMTVhMTk=
12
12
  data.tar.gz: !binary |-
13
- YmYwYjYzN2UwY2IyNzIzZTI3M2EzZTFhOTAwOWUyMzVhMWFkOWRjODRjNmUy
14
- NTIwMjA3ODlmZTE3MzZkMDI0MmNlZTk3MTk1NTdlOWQzOThiNDhmMTg2ZWRk
15
- MjJlNWVlNGZhMWFiOTJmMGVlMjUxZGMyZGQ3Nzc3M2VkODdiMjI=
13
+ NWVhYzNlYjk3YzI1MmRmNzc3ZWE5YzIxNWRkNTUxMTEzNDZkYmIzYTJjNzM3
14
+ MjRkMzQwNDZmODYyYTRhZDc1OWMwMGY0N2I4MWY5ZThiNjY0Y2RjMGZmYmI1
15
+ ZTAwYTQwNTUyMGM1MTViMDE3MDFmYmM5OWIzYThjMWI2ZWFkMGE=
@@ -0,0 +1,14 @@
1
+ module WhereTo
2
+ class Configuration
3
+ attr_accessor :folder_format
4
+
5
+ def initialize
6
+ @folder_format = "%series_title/Season %season_number (%season_airdate)/"
7
+ end
8
+
9
+ def folder_format
10
+ @folder_format.dup
11
+ end
12
+
13
+ end
14
+ end
@@ -1,22 +1,21 @@
1
1
  require 'where_to/location'
2
+ require 'where_to/configuration'
2
3
  require 'yaml'
3
4
 
4
5
  module WhereTo
5
6
  class Locator
6
7
  attr_accessor :series_title, :airdate, :season, :season_airdate
7
8
  attr_accessor :episode_title, :episode_number, :episode_quality, :episode_extension
8
- FORMAT_FILE = 'lib/where_to/format.yml'
9
9
 
10
10
  def initialize(hash = {})
11
11
  load_values_from hash
12
- @format_file = YAML.load_file FORMAT_FILE
13
12
  end
14
13
 
15
14
  def locate(hash = {})
16
15
  load_values_from hash
17
16
  validate!
18
17
 
19
- output = @format_file['folder_format']
18
+ output = WhereTo.configuration.folder_format
20
19
  output.gsub! '%series_title', series_title
21
20
  output.gsub! '%season_number', season.to_s
22
21
  output.gsub! '%season_airdate', season_airdate.to_s
@@ -1,3 +1,3 @@
1
1
  module WhereTo
2
- VERSION = "0.8.1"
2
+ VERSION = "0.9.0"
3
3
  end
data/lib/where_to.rb CHANGED
@@ -1,7 +1,23 @@
1
1
  require 'where_to/version'
2
2
  require 'where_to/locator'
3
3
  require 'where_to/location'
4
+ require 'where_to/configuration'
4
5
 
5
6
  module WhereTo
7
+ class << self
8
+ attr_accessor :configuration
9
+ end
6
10
 
7
- end
11
+ def self.configuration
12
+ @configuration ||= Configuration.new
13
+ end
14
+
15
+ def self.reset
16
+ @configuration = Configuration.new
17
+ end
18
+
19
+ def self.configure
20
+ yield configuration
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Toniazzo
@@ -96,8 +96,8 @@ files:
96
96
  - bin/console
97
97
  - bin/setup
98
98
  - lib/where_to.rb
99
+ - lib/where_to/configuration.rb
99
100
  - lib/where_to/episode_formatter.rb
100
- - lib/where_to/format.yml
101
101
  - lib/where_to/location.rb
102
102
  - lib/where_to/locator.rb
103
103
  - lib/where_to/version.rb
@@ -1 +0,0 @@
1
- folder_format: "%series_title/Season %season_number (%season_airdate)/"