Module: Pushover::App
Overview
Stores a application definition in the config file.
Defined Under Namespace
Classes: App
Instance Method Summary collapse
-
#add(api_key, name) ⇒ Boolean
Add an application to the config file and save it.
-
#current_app ⇒ Object
Return the current app selected, or the first one saved.
-
#current_app? ⇒ Boolean
Will return true if we can find an application either via the cli or save file.
-
#find(word) ⇒ String
Find the apikey in the applications, or pass on the word to try direct access.
Instance Method Details
#add(api_key, name) ⇒ Boolean
Add an application to the config file and save it.
39 40 41 42 |
# File 'lib/pushover/app.rb', line 39 def add(api_key, name) App.new api_key, name Pushover::Config.save! end |
#current_app ⇒ Object
Return the current app selected, or the first one saved.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pushover/app.rb', line 45 def current_app return @current_app if @current_app # did something get supplied on the cli? try to find it. if Options[:appkey] @current_app = Pushover::App.find Options[:appkey] end # no? do we have anything we can return? if !@current_app @current_app = Config[:applications].first end @current_app end |
#current_app? ⇒ Boolean
Will return true if we can find an application either via the cli or save file.
61 62 63 64 |
# File 'lib/pushover/app.rb', line 61 def current_app? return true if current_app return nil end |