Class: GitGrabber::Config
- Inherits:
-
Object
- Object
- GitGrabber::Config
- Defined in:
- lib/git_grabber/config.rb
Instance Attribute Summary collapse
-
#backup_directory ⇒ Object
Returns the value of attribute backup_directory.
-
#github_personal_token ⇒ Object
Returns the value of attribute github_personal_token.
-
#interval ⇒ Object
Returns the value of attribute interval.
Instance Method Summary collapse
-
#initialize(conf) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(conf) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git_grabber/config.rb', line 7 def initialize(conf) missing = [] config = JSON.parse(conf) %w{ interval github_personal_token backup_directory }.each do |required| if config[required].nil? missing << required end end raise "missing required options #{missing.join(', ')}" unless missing.empty? @interval = [config["interval"], 60].max # force 60 seconds min interval @github_personal_token = config["github_personal_token"] @backup_directory = config["backup_directory"] end |
Instance Attribute Details
#backup_directory ⇒ Object
Returns the value of attribute backup_directory.
5 6 7 |
# File 'lib/git_grabber/config.rb', line 5 def backup_directory @backup_directory end |
#github_personal_token ⇒ Object
Returns the value of attribute github_personal_token.
5 6 7 |
# File 'lib/git_grabber/config.rb', line 5 def github_personal_token @github_personal_token end |
#interval ⇒ Object
Returns the value of attribute interval.
5 6 7 |
# File 'lib/git_grabber/config.rb', line 5 def interval @interval end |