Class: Belt::CLI::TablesCommand::SchemaParser
- Inherits:
-
Object
- Object
- Belt::CLI::TablesCommand::SchemaParser
- Defined in:
- lib/belt/cli/tables_command.rb
Overview
Minimal DSL parser for schema.tf.rb
Instance Attribute Summary collapse
-
#models ⇒ Object
readonly
Returns the value of attribute models.
Instance Method Summary collapse
-
#initialize ⇒ SchemaParser
constructor
A new instance of SchemaParser.
- #model(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ SchemaParser
Returns a new instance of SchemaParser.
114 115 116 |
# File 'lib/belt/cli/tables_command.rb', line 114 def initialize @models = [] end |
Instance Attribute Details
#models ⇒ Object (readonly)
Returns the value of attribute models.
112 113 114 |
# File 'lib/belt/cli/tables_command.rb', line 112 def models @models end |
Instance Method Details
#model(name, &block) ⇒ Object
118 119 120 121 122 |
# File 'lib/belt/cli/tables_command.rb', line 118 def model(name, &block) model_def = ModelParser.new model_def.instance_eval(&block) if block @models << { name: name.to_s, fields: model_def.fields } end |