Class: PathGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/path_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath, results_path, ymd) ⇒ PathGenerator

Returns a new instance of PathGenerator.



8
9
10
11
12
13
14
15
# File 'lib/path_generator.rb', line 8

def initialize(filepath, results_path, ymd)
  @filepath = filepath
  @results_path = results_path
  @year = ymd & 0b100 != 0
  @month = ymd & 0b010 != 0
  @day = ymd & 0b001 != 0
  @timestamp = Time.now
end

Instance Attribute Details

#dayObject (readonly)

Returns the value of attribute day.



2
3
4
# File 'lib/path_generator.rb', line 2

def day
  @day
end

#filepathObject (readonly)

Returns the value of attribute filepath.



2
3
4
# File 'lib/path_generator.rb', line 2

def filepath
  @filepath
end

#monthObject (readonly)

Returns the value of attribute month.



2
3
4
# File 'lib/path_generator.rb', line 2

def month
  @month
end

#results_pathObject (readonly)

Returns the value of attribute results_path.



2
3
4
# File 'lib/path_generator.rb', line 2

def results_path
  @results_path
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



2
3
4
# File 'lib/path_generator.rb', line 2

def timestamp
  @timestamp
end

#yearObject (readonly)

Returns the value of attribute year.



2
3
4
# File 'lib/path_generator.rb', line 2

def year
  @year
end

Class Method Details

.call(filepath, results_path, ymd) ⇒ Object



4
5
6
# File 'lib/path_generator.rb', line 4

def self.call(filepath, results_path, ymd)
  new(filepath, results_path, ymd).call
end

Instance Method Details

#callObject



17
18
19
# File 'lib/path_generator.rb', line 17

def call
  File.join(produce_path, produce_dirname)
end