Class: Parasort::Atom
- Inherits:
-
Object
- Object
- Parasort::Atom
- Defined in:
- lib/parasort.rb
Constant Summary collapse
- SIZE =
ENV['PARASORT_ATOM_SIZE'].to_i.yield_self{ |n| n > 0 ? n : 10000 }
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(path) ⇒ Atom
constructor
A new instance of Atom.
- #move_to_dir(dir) ⇒ Object
Constructor Details
#initialize(path) ⇒ Atom
Returns a new instance of Atom.
75 76 77 78 |
# File 'lib/parasort.rb', line 75 def initialize(path) @path = path @range = File.basename(@path).split('_').map(&:to_i) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
71 72 73 |
# File 'lib/parasort.rb', line 71 def path @path end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
71 72 73 |
# File 'lib/parasort.rb', line 71 def range @range end |
Instance Method Details
#each(&block) ⇒ Object
85 86 87 |
# File 'lib/parasort.rb', line 85 def each(&block) File.foreach(@path, &block) end |
#move_to_dir(dir) ⇒ Object
80 81 82 83 |
# File 'lib/parasort.rb', line 80 def move_to_dir(dir) FileUtils.mv(@path, dir) @path = File.join(dir, File.basename(@path)) end |