Class: Nandi::Renderers::ActiveRecord::Instructions::CreateTableCell
- Inherits:
-
Base
- Object
- Cell::ViewModel
- Base
- Nandi::Renderers::ActiveRecord::Instructions::CreateTableCell
- Defined in:
- lib/nandi/renderers/active_record/instructions.rb
Instance Method Summary collapse
- #columns ⇒ Object
- #extra_args ⇒ Object
- #extra_args? ⇒ Boolean
- #timestamps? ⇒ Boolean
- #timestamps_args ⇒ Object
- #timestamps_args? ⇒ Boolean
Methods inherited from Base
Methods included from Formatting
Instance Method Details
#columns ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 61 def columns model.columns.map do |c| ::Nandi::Instructions::CreateTable::Column.new( name: format_value(c.name), type: format_value(c.type), ).tap do |col| col.args = format_value(c.args, as_argument: true) unless c.args.empty? end end end |
#extra_args ⇒ Object
57 58 59 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 57 def extra_args format_value(model.extra_args, as_argument: true) end |
#extra_args? ⇒ Boolean
49 50 51 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 49 def extra_args? model.extra_args&.any? end |
#timestamps? ⇒ Boolean
41 42 43 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 41 def !model..nil? end |
#timestamps_args ⇒ Object
53 54 55 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 53 def format_value(model., as_argument: true) end |
#timestamps_args? ⇒ Boolean
45 46 47 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 45 def !model.&.empty? end |