Class: Vk::Schema::Generator::Common
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Vk::Schema::Generator::Common
- Includes:
- Thor::Actions
- Defined in:
- lib/vk/schema/generator/common.rb
Direct Known Subclasses
Client, Errors, Method, Methods, Object, Objects, Response, Responses, Type, Types
Instance Attribute Summary collapse
- #schema ⇒ Vk::Schema readonly
Class Method Summary collapse
-
.create_definition ⇒ Object
Provides methods for building class and specification for provided definition.
- .source_root ⇒ String
Instance Attribute Details
Class Method Details
.create_definition ⇒ Object
Provides methods for building class and specification for provided definition
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vk/schema/generator/common.rb', line 25 def self.create_definition name = self.name.demodulize.underscore template_name = "#{name}.tt" spec_template_name = "#{name}_spec.tt" define_method(:"create_#{name}") do overwrite_template(template_name, definition.definition_file) end if (source_root / template_name).exist? define_method(:"create_#{name}_spec") do overwrite_template(spec_template_name, definition.spec_file) end if (source_root / spec_template_name).exist? end |
.source_root ⇒ String
19 20 21 |
# File 'lib/vk/schema/generator/common.rb', line 19 def self.source_root Pathname.new(File.('../../templates', __FILE__)) end |