Class: Fluent::Json::Schema::Terms::Field
- Inherits:
-
Object
- Object
- Fluent::Json::Schema::Terms::Field
- Defined in:
- lib/fluent/json/schema/terms/field.rb
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#enum ⇒ Object
readonly
Returns the value of attribute enum.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(name, options = {}) ⇒ Field
constructor
A new instance of Field.
- #mandate ⇒ Object
- #optionalise ⇒ Object
- #set(options = {}) ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Field
Returns a new instance of Field.
8 9 10 11 12 13 14 |
# File 'lib/fluent/json/schema/terms/field.rb', line 8 def initialize(name, ={}) @name = name @required = [:required] @constraints = [] self.set() end |
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
6 7 8 |
# File 'lib/fluent/json/schema/terms/field.rb', line 6 def constraints @constraints end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
6 7 8 |
# File 'lib/fluent/json/schema/terms/field.rb', line 6 def default @default end |
#enum ⇒ Object (readonly)
Returns the value of attribute enum.
6 7 8 |
# File 'lib/fluent/json/schema/terms/field.rb', line 6 def enum @enum end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/fluent/json/schema/terms/field.rb', line 6 def name @name end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
6 7 8 |
# File 'lib/fluent/json/schema/terms/field.rb', line 6 def required @required end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/fluent/json/schema/terms/field.rb', line 6 def version @version end |
Instance Method Details
#as_json(options = {}) ⇒ Object
31 32 33 |
# File 'lib/fluent/json/schema/terms/field.rb', line 31 def as_json(={}) return .merge(self.as_json_fragment(:default, :enum)) end |
#mandate ⇒ Object
16 17 18 19 |
# File 'lib/fluent/json/schema/terms/field.rb', line 16 def mandate @required = true return self end |
#optionalise ⇒ Object
21 22 23 24 |
# File 'lib/fluent/json/schema/terms/field.rb', line 21 def optionalise @required = false return self end |
#set(options = {}) ⇒ Object
26 27 28 29 |
# File 'lib/fluent/json/schema/terms/field.rb', line 26 def set(={}) @enum = [:enum] @default = [:default] end |