Class: RuboCop::Schema::CopSchema

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/rubocop/schema/cop_schema.rb

Constant Summary collapse

KNOWN_TYPES =
{
  'boolean' => 'boolean',
  'integer' => 'integer',
  'array'   => 'array',
  'string'  => 'string',
  'float'   => 'number'
}.freeze

Instance Method Summary collapse

Methods included from Helpers

#boolean, #deep_dup, #deep_merge, #http_get, #strip_html, #template, templates

Constructor Details

#initialize(info) ⇒ CopSchema

Returns a new instance of CopSchema.

Parameters:



17
18
19
20
21
# File 'lib/rubocop/schema/cop_schema.rb', line 17

def initialize(info)
  @info = info.dup.freeze
  @json = template('cop_schema')
  generate
end

Instance Method Details

#as_jsonObject Also known as: to_h



23
24
25
# File 'lib/rubocop/schema/cop_schema.rb', line 23

def as_json
  @json
end

#freezeObject



29
30
31
32
# File 'lib/rubocop/schema/cop_schema.rb', line 29

def freeze
  @json.freeze
  super
end