Class: Vk::Schema::Generator::Common

Inherits:
Thor::Group
  • Object
show all
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

Class Method Summary collapse

Instance Attribute Details

#schemaVk::Schema (readonly)

Returns:


# File 'lib/vk/schema/generator/common.rb', line 15

Class Method Details

.create_definitionObject

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_rootString

Returns:

  • (String)

19
20
21
# File 'lib/vk/schema/generator/common.rb', line 19

def self.source_root
  Pathname.new(File.expand_path('../../templates', __FILE__))
end