Class: Ruber::ProjectFiles
- Includes:
- Enumerable
- Defined in:
- lib/ruber/project_dir_scanner.rb
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #__setobj__(obj) ⇒ Object
- #clone ⇒ Object
- #dup ⇒ Object
- #each ⇒ Object (also: #abs)
- #each_relative ⇒ Object (also: #rel)
-
#initialize(project_dir, set) ⇒ ProjectFiles
constructor
A new instance of ProjectFiles.
- #to_set ⇒ Object
Methods included from Enumerable
Constructor Details
#initialize(project_dir, set) ⇒ ProjectFiles
Returns a new instance of ProjectFiles.
116 117 118 119 120 121 |
# File 'lib/ruber/project_dir_scanner.rb', line 116 def initialize project_dir, set super set @set = set @project_dir = project_dir.dup @project_dir << '/' unless @project_dir.end_with? '/' end |
Instance Method Details
#__getobj__ ⇒ Object
123 124 125 |
# File 'lib/ruber/project_dir_scanner.rb', line 123 def __getobj__ @set end |
#__setobj__(obj) ⇒ Object
127 128 129 |
# File 'lib/ruber/project_dir_scanner.rb', line 127 def __setobj__ obj @set = obj end |
#clone ⇒ Object
135 136 137 138 139 |
# File 'lib/ruber/project_dir_scanner.rb', line 135 def clone res = dup dup.freeze if frozen? res end |
#dup ⇒ Object
131 132 133 |
# File 'lib/ruber/project_dir_scanner.rb', line 131 def dup self.class.new @project_dir, @set end |
#each ⇒ Object Also known as: abs
154 155 156 157 158 159 |
# File 'lib/ruber/project_dir_scanner.rb', line 154 def each if block_given? @set.each{|f| yield f} else self.to_enum end end |
#each_relative ⇒ Object Also known as: rel
145 146 147 148 149 150 151 |
# File 'lib/ruber/project_dir_scanner.rb', line 145 def each_relative if block_given? l = @project_dir.size @set.each{|f| yield f[l, f.size-l]} else self.to_enum :each_relative end end |
#to_set ⇒ Object
141 142 143 |
# File 'lib/ruber/project_dir_scanner.rb', line 141 def to_set Set.new self end |