Class: RabbitFeed::EventDefinitions::Field

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/rabbit_feed/event_definitions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, definition) ⇒ Field

Returns a new instance of Field.



9
10
11
12
13
14
# File 'lib/rabbit_feed/event_definitions.rb', line 9

def initialize(name, type, definition)
  @name       = name
  @type       = type
  @definition = definition
  validate!
end

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



6
7
8
# File 'lib/rabbit_feed/event_definitions.rb', line 6

def definition
  @definition
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/rabbit_feed/event_definitions.rb', line 6

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/rabbit_feed/event_definitions.rb', line 6

def type
  @type
end

Instance Method Details

#schemaObject



16
17
18
# File 'lib/rabbit_feed/event_definitions.rb', line 16

def schema
  { name: name, type: type, doc: definition }
end