Class: Lacerda::Specification

Inherits:
Object
  • Object
show all
Defined in:
lib/lacerda/specification.rb

Direct Known Subclasses

ConsumeSpecification, PublishSpecification

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, schema_or_file) ⇒ Specification

Returns a new instance of Specification.



9
10
11
12
# File 'lib/lacerda/specification.rb', line 9

def initialize(service, schema_or_file)
  @service = service
  load_schema(schema_or_file)
end

Instance Attribute Details

#schemaObject (readonly)

Returns the value of attribute schema.



7
8
9
# File 'lib/lacerda/specification.rb', line 7

def schema
  @schema
end

#serviceObject (readonly)

Returns the value of attribute service.



7
8
9
# File 'lib/lacerda/specification.rb', line 7

def service
  @service
end

Instance Method Details

#objectsObject



14
15
16
17
18
19
20
# File 'lib/lacerda/specification.rb', line 14

def objects
  return [] unless @schema[:definitions]
  @schema[:definitions].map do |scoped_name, schema|
    next if !scoped_name.index(SCOPE_SEPARATOR)
    object_description_class.new(service, scoped_name, schema)
  end.compact
end