Class: Shortcuts::Shortcut
- Inherits:
-
Object
- Object
- Shortcuts::Shortcut
- Defined in:
- lib/bujo/shortcuts/shortcut.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(name, source, target) ⇒ Shortcut
constructor
A new instance of Shortcut.
- #to_s ⇒ Object
Constructor Details
#initialize(name, source, target) ⇒ Shortcut
Returns a new instance of Shortcut.
7 8 9 10 11 |
# File 'lib/bujo/shortcuts/shortcut.rb', line 7 def initialize(name, source, target) @name = name @source = source @target = target end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/bujo/shortcuts/shortcut.rb', line 5 def name @name end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/bujo/shortcuts/shortcut.rb', line 5 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/bujo/shortcuts/shortcut.rb', line 5 def target @target end |
Instance Method Details
#create ⇒ Object
13 14 15 16 |
# File 'lib/bujo/shortcuts/shortcut.rb', line 13 def create puts("* #{@name} link: #{@source} --> #{@target}") FileUtils.copy("target/#{@source}", "target/#{@target}") if (File.exist?("target/#{@source}")) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/bujo/shortcuts/shortcut.rb', line 18 def to_s "#{@name}: #{@source} --> #{@target}" end |