Class: GoonModelGen::Builder::ValidationBuilder
- Inherits:
-
AbstractBuilder
- Object
- AbstractBuilder
- GoonModelGen::Builder::ValidationBuilder
- Defined in:
- lib/goon_model_gen/builder/validation_builder.rb
Instance Attribute Summary
Attributes inherited from AbstractBuilder
#base_package_path, #config, #package_suffix
Instance Method Summary collapse
- #build ⇒ Golang::Packages
-
#initialize(config) ⇒ ValidationBuilder
constructor
A new instance of ValidationBuilder.
- #resolve_type_names(pkgs) ⇒ Object
Methods inherited from AbstractBuilder
#build_package, #build_sentences, #build_sentences_with, #method_to_template_for, #method_to_template_map, #templates_for
Constructor Details
#initialize(config) ⇒ ValidationBuilder
Returns a new instance of ValidationBuilder.
15 16 17 |
# File 'lib/goon_model_gen/builder/validation_builder.rb', line 15 def initialize(config) super(config, config.validation_package_path) end |
Instance Method Details
#build ⇒ Golang::Packages
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/goon_model_gen/builder/validation_builder.rb', line 20 def build(*) Golang::Packages.new.tap do |r| r.new_package(base_package_path).tap do |pkg| t = pkg.new_struct('ValidationError') pkg.new_file('validation_error.go').tap do |f| build_sentences_with('validation/error', t, nil) end end end end |
#resolve_type_names(pkgs) ⇒ Object
32 33 34 |
# File 'lib/goon_model_gen/builder/validation_builder.rb', line 32 def resolve_type_names(pkgs) pkgs.resolve_type_names(Golang::DatastorePackageFactory.new(config.package_alias_map).packages) end |