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
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 62 def columns model.columns.map do |c| OpenStruct.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
58 59 60 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 58 def extra_args format_value(model.extra_args, as_argument: true) end |
#extra_args? ⇒ Boolean
50 51 52 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 50 def extra_args? model.extra_args&.any? end |
#timestamps? ⇒ Boolean
42 43 44 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 42 def !model..nil? end |
#timestamps_args ⇒ Object
54 55 56 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 54 def format_value(model., as_argument: true) end |
#timestamps_args? ⇒ Boolean
46 47 48 |
# File 'lib/nandi/renderers/active_record/instructions.rb', line 46 def !model.&.empty? end |