Class: Rly::Shortcuts
- Inherits:
-
Object
- Object
- Rly::Shortcuts
- Defined in:
- lib/rly/shortcuts.rb
Overview
shortcuts repository
Instance Method Summary collapse
- #all ⇒ Object
- #create(name, url) ⇒ Object
- #destroy(name) ⇒ Object
- #exist?(name) ⇒ Boolean
- #find(name) ⇒ Object
-
#initialize ⇒ Shortcuts
constructor
A new instance of Shortcuts.
Constructor Details
#initialize ⇒ Shortcuts
Returns a new instance of Shortcuts.
6 7 8 9 10 |
# File 'lib/rly/shortcuts.rb', line 6 def initialize @name = Dir.pwd.tr('/', '') @filename = %(/var/lib/rly/#{@name}.json) @shortcuts = read end |
Instance Method Details
#all ⇒ Object
12 13 14 |
# File 'lib/rly/shortcuts.rb', line 12 def all @shortcuts end |
#create(name, url) ⇒ Object
24 25 26 27 |
# File 'lib/rly/shortcuts.rb', line 24 def create(name, url) @shortcuts[name] = url save end |
#destroy(name) ⇒ Object
29 30 31 32 |
# File 'lib/rly/shortcuts.rb', line 29 def destroy(name) @shortcuts.delete(name) save end |
#exist?(name) ⇒ Boolean
20 21 22 |
# File 'lib/rly/shortcuts.rb', line 20 def exist?(name) @shortcuts.key?(name) end |
#find(name) ⇒ Object
16 17 18 |
# File 'lib/rly/shortcuts.rb', line 16 def find(name) @shortcuts[name] end |