Class: KafkaRest::Schema
- Inherits:
-
Object
- Object
- KafkaRest::Schema
- Defined in:
- lib/kafka_rest/schema.rb
Constant Summary collapse
- AVRO_CONTENT =
'application/vnd.kafka.avro.v1+json'.freeze
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#id ⇒ Object
Returns the value of attribute id.
-
#serialized ⇒ Object
readonly
Returns the value of attribute serialized.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(serialized) ⇒ Schema
constructor
A new instance of Schema.
- #update_id(id) ⇒ Object
Constructor Details
#initialize(serialized) ⇒ Schema
Returns a new instance of Schema.
12 13 14 15 16 17 |
# File 'lib/kafka_rest/schema.rb', line 12 def initialize(serialized) @id = nil @serialized = serialized @mutex = Mutex.new @content_type = AVRO_CONTENT end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
6 7 8 |
# File 'lib/kafka_rest/schema.rb', line 6 def content_type @content_type end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/kafka_rest/schema.rb', line 5 def id @id end |
#serialized ⇒ Object (readonly)
Returns the value of attribute serialized.
6 7 8 |
# File 'lib/kafka_rest/schema.rb', line 6 def serialized @serialized end |
Class Method Details
.parse(file) ⇒ Object
8 9 10 |
# File 'lib/kafka_rest/schema.rb', line 8 def self.parse(file) new(SchemaParser.call(file)) end |
Instance Method Details
#update_id(id) ⇒ Object
19 20 21 |
# File 'lib/kafka_rest/schema.rb', line 19 def update_id(id) @mutex.synchronize { @id = id } end |