Class: AwesomeAnnotate::CLI
- Inherits:
-
Thor
- Object
- Thor
- AwesomeAnnotate::CLI
- Defined in:
- lib/awesome_annotate/cli.rb
Instance Method Summary collapse
Instance Method Details
#annotate ⇒ Object
8 9 10 11 12 |
# File 'lib/awesome_annotate/cli.rb', line 8 def annotate puts "annotate your code" return 'annotate your code' # AwesomeAnnotate::Annotator.new.annotate end |
#model(model_name) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/awesome_annotate/cli.rb', line 15 def model(model_name) name = model_name.singularize.camelize klass = Object.const_get(name) puts 'This is not a model' unless klass < ActiveRecord::Base column_names = klass.column_names model_dir = 'app/models' file_path = "#{model_dir}/#{model_name}.rb" File.open(file_path, 'r') do |file| file.puts "# Columns: #{column_names.join(', ')}" end puts 'annotate your model' end |