Class: Dotify::Collection
- Inherits:
-
Object
- Object
- Dotify::Collection
- Includes:
- Enumerable
- Defined in:
- lib/dotify/collection.rb
Instance Attribute Summary collapse
-
#dots ⇒ Object
Returns the value of attribute dots.
Instance Method Summary collapse
-
#each(&block) ⇒ Object
Defined each method for Enumerable.
-
#initialize(location = :dotfiles) ⇒ Collection
constructor
Pulls an array of Dots from the home directory.
- #inspect ⇒ Object
-
#linked ⇒ Object
Linked files are those files which have a symbolic link pointing to the Dotify file.
- #to_s ⇒ Object
-
#unlinked ⇒ Object
Unlinked files are, of course, the opposite of linked files.
Constructor Details
#initialize(location = :dotfiles) ⇒ Collection
Pulls an array of Dots from the home directory.
10 11 12 13 14 15 16 17 |
# File 'lib/dotify/collection.rb', line 10 def initialize(location = :dotfiles) @dots ||= case location when :dotfiles then Filter.home when :dotify then Filter.dotify else raise ArgumentError, "You must specify :dotfiles or :dotify when initializing Collection" end end |
Instance Attribute Details
#dots ⇒ Object
Returns the value of attribute dots.
6 7 8 |
# File 'lib/dotify/collection.rb', line 6 def dots @dots end |
Instance Method Details
#each(&block) ⇒ Object
Defined each method for Enumerable
20 21 22 |
# File 'lib/dotify/collection.rb', line 20 def each(&block) dots.each(&block) end |
#inspect ⇒ Object
41 42 43 |
# File 'lib/dotify/collection.rb', line 41 def inspect dots.map(&:inspect) end |
#linked ⇒ Object
Linked files are those files which have a symbolic link pointing to the Dotify file.
26 27 28 |
# File 'lib/dotify/collection.rb', line 26 def linked select(&:linked?) end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/dotify/collection.rb', line 37 def to_s dots.to_s end |
#unlinked ⇒ Object
Unlinked files are, of course, the opposite of linked files. These are Dotify files which Have no home dir files that are linked to them.
33 34 35 |
# File 'lib/dotify/collection.rb', line 33 def unlinked reject(&:linked?) end |