Class: Fluent::Json::Schema::Terms::Str
- Defined in:
- lib/fluent/json/schema/terms/str.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#max_length ⇒ Object
readonly
Returns the value of attribute max_length.
-
#min_length ⇒ Object
readonly
Returns the value of attribute min_length.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Attributes inherited from Field
#constraints, #default, #enum, #name, #required, #version
Instance Method Summary collapse
- #as_json ⇒ Object
- #datetime ⇒ Object
- #email ⇒ Object
-
#initialize(name, options = {}) ⇒ Str
constructor
A new instance of Str.
- #set(options = {}) ⇒ Object
- #uri ⇒ Object
Methods inherited from Field
Constructor Details
#initialize(name, options = {}) ⇒ Str
Returns a new instance of Str.
7 8 9 |
# File 'lib/fluent/json/schema/terms/str.rb', line 7 def initialize(name, ={}) super(name, ) end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/fluent/json/schema/terms/str.rb', line 5 def format @format end |
#max_length ⇒ Object (readonly)
Returns the value of attribute max_length.
5 6 7 |
# File 'lib/fluent/json/schema/terms/str.rb', line 5 def max_length @max_length end |
#min_length ⇒ Object (readonly)
Returns the value of attribute min_length.
5 6 7 |
# File 'lib/fluent/json/schema/terms/str.rb', line 5 def min_length @min_length end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
5 6 7 |
# File 'lib/fluent/json/schema/terms/str.rb', line 5 def pattern @pattern end |
Instance Method Details
#as_json ⇒ Object
32 33 34 35 36 |
# File 'lib/fluent/json/schema/terms/str.rb', line 32 def as_json super({ type: :string }).merge!( self.as_json_fragment(:min_length, :max_length, :format, :pattern) ) end |
#datetime ⇒ Object
20 21 22 |
# File 'lib/fluent/json/schema/terms/str.rb', line 20 def datetime @format = :'date-time' end |
#email ⇒ Object
24 25 26 |
# File 'lib/fluent/json/schema/terms/str.rb', line 24 def email @format = :email end |
#set(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/fluent/json/schema/terms/str.rb', line 11 def set(={}) super() @min_length ||= [:min] @max_length ||= [:max] @format ||= [:fmt] @pattern ||= [:pattern] return self end |
#uri ⇒ Object
28 29 30 |
# File 'lib/fluent/json/schema/terms/str.rb', line 28 def uri @format = :uri end |