Class: Ruber::ProjectFiles

Inherits:
Delegator
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ruber/project_dir_scanner.rb

Instance Method Summary (collapse)

Methods included from Enumerable

#find!

Constructor Details

- (ProjectFiles) initialize(project_dir, set)

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

- (Object) __getobj__



123
124
125
# File 'lib/ruber/project_dir_scanner.rb', line 123

def __getobj__
  @set
end

- (Object) __setobj__(obj)



127
128
129
# File 'lib/ruber/project_dir_scanner.rb', line 127

def __setobj__ obj
  @set = obj
end

- (Object) clone



135
136
137
138
139
# File 'lib/ruber/project_dir_scanner.rb', line 135

def clone
  res = dup
  dup.freeze if frozen?
  res
end

- (Object) dup



131
132
133
# File 'lib/ruber/project_dir_scanner.rb', line 131

def dup
  self.class.new @project_dir, @set
end

- (Object) each 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

- (Object) each_relative 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

- (Object) to_set



141
142
143
# File 'lib/ruber/project_dir_scanner.rb', line 141

def to_set
  Set.new self
end