Class: ControllerWriter
- Inherits:
-
Object
- Object
- ControllerWriter
- Defined in:
- app/writers/controller_writer.rb
Instance Attribute Summary collapse
-
#data_table ⇒ Object
readonly
Returns the value of attribute data_table.
Instance Method Summary collapse
-
#initialize(data_table) ⇒ ControllerWriter
constructor
A new instance of ControllerWriter.
- #write ⇒ Object
Constructor Details
#initialize(data_table) ⇒ ControllerWriter
Returns a new instance of ControllerWriter.
3 4 5 |
# File 'app/writers/controller_writer.rb', line 3 def initialize(data_table) @data_table = data_table end |
Instance Attribute Details
#data_table ⇒ Object (readonly)
Returns the value of attribute data_table.
2 3 4 |
# File 'app/writers/controller_writer.rb', line 2 def data_table @data_table end |
Instance Method Details
#write ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/writers/controller_writer.rb', line 7 def write if File.exists?(filename) puts "Controller already defined for #{data_table.name}. Skipping" return end FileUtils.mkdir_p('app/controllers/gatherable') File.open(filename, 'w') do |f| f.puts controller_contents end puts "created #{filename}" if File.exists?(filename) end |