Class: Proptax::Generators::Report

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/proptax/generators/report.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#addressObject

Returns the value of attribute address.


7
8
9
# File 'lib/proptax/generators/report.rb', line 7

def address
  @address
end

#assessed_valueObject

Returns the value of attribute assessed_value.


7
8
9
# File 'lib/proptax/generators/report.rb', line 7

def assessed_value
  @assessed_value
end

#y_axis_limitsObject

Returns the value of attribute y_axis_limits.


7
8
9
# File 'lib/proptax/generators/report.rb', line 7

def y_axis_limits
  @y_axis_limits
end

Class Method Details

.source_rootObject


26
27
28
# File 'lib/proptax/generators/report.rb', line 26

def self.source_root
  File.dirname(__FILE__) + "/report"
end

Instance Method Details

#copy_report_templateObject


17
18
19
20
21
22
23
24
# File 'lib/proptax/generators/report.rb', line 17

def copy_report_template
  CSV.foreach(csv_file, headers: true) do |row|
    self.address = row['Location Address']
    self.assessed_value = row['Current Assessed Value']
    file_name = address.gsub(/\s/, '_')
    template("#{opts.template}.Rmd", "reports/#{file_name}.Rmd")
  end
end

#create_report_dirObject


12
13
14
15
# File 'lib/proptax/generators/report.rb', line 12

def create_report_dir
  empty_directory('reports')
  FileUtils.cp(csv_file, "reports")
end