Class: Atum::Generation::GeneratorResource

Inherits:
Object
  • Object
show all
Defined in:
lib/atum/generation/generator_resource.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource_schema) ⇒ GeneratorResource

Returns a new instance of GeneratorResource.



4
5
6
# File 'lib/atum/generation/generator_resource.rb', line 4

def initialize(resource_schema)
  @resource_schema = resource_schema
end

Instance Method Details

#class_nameObject

The name of the resource class in generated code.



26
27
28
# File 'lib/atum/generation/generator_resource.rb', line 26

def class_name
  name.camelcase
end

#descriptionObject

Description of the resource.



14
15
16
# File 'lib/atum/generation/generator_resource.rb', line 14

def description
  @resource_schema.description
end

Links available on this resource.



19
20
21
22
23
# File 'lib/atum/generation/generator_resource.rb', line 19

def links
  @links ||= @resource_schema.link_schemas.map do |link_schema|
    GeneratorLink.new(link_schema)
  end
end

#nameObject

The name of the resource, in snake case.



9
10
11
# File 'lib/atum/generation/generator_resource.rb', line 9

def name
  @resource_schema.name.gsub('-', '_')
end