Class: Crudboy::TemplateContext
- Includes:
- Helper
- Defined in:
- lib/crudboy/template_context.rb
Instance Attribute Summary collapse
-
#bundle_options ⇒ Object
Returns the value of attribute bundle_options.
-
#columns(**options) ⇒ Object
Returns the value of attribute columns.
-
#model ⇒ Object
Returns the value of attribute model.
-
#model_name ⇒ Object
Returns the value of attribute model_name.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Instance Method Summary collapse
- #binding ⇒ Object
- #eval(string) ⇒ Object
-
#initialize(definition) ⇒ TemplateContext
constructor
A new instance of TemplateContext.
- #method_missing(method, *args, **options, &block) ⇒ Object
Methods included from Helper
#batch_insert_values_list, #column_names_list, #insert_values_list, #lombok
Constructor Details
#initialize(definition) ⇒ TemplateContext
Returns a new instance of TemplateContext.
8 9 10 11 12 13 |
# File 'lib/crudboy/template_context.rb', line 8 def initialize(definition) @model = definition.model @model_name = definition.model_name @table_name = definition.table_name @columns = @model.columns end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, **options, &block) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/crudboy/template_context.rb', line 27 def method_missing(method, *args, **, &block) if args.empty? && .empty? && block.nil? && .table.keys.include?(method) .send(method) else super end end |
Instance Attribute Details
#bundle_options ⇒ Object
Returns the value of attribute bundle_options.
6 7 8 |
# File 'lib/crudboy/template_context.rb', line 6 def @bundle_options end |
#columns(**options) ⇒ Object
Returns the value of attribute columns.
6 7 8 |
# File 'lib/crudboy/template_context.rb', line 6 def columns @columns end |
#model ⇒ Object
Returns the value of attribute model.
6 7 8 |
# File 'lib/crudboy/template_context.rb', line 6 def model @model end |
#model_name ⇒ Object
Returns the value of attribute model_name.
6 7 8 |
# File 'lib/crudboy/template_context.rb', line 6 def model_name @model_name end |
#table_name ⇒ Object
Returns the value of attribute table_name.
6 7 8 |
# File 'lib/crudboy/template_context.rb', line 6 def table_name @table_name end |