Class: Field
- Inherits:
-
CheckValues
- Object
- CheckValues
- Field
- Defined in:
- lib/chino_ruby.rb
Overview
Class which defines the fields for the creation of a Schema or a UserSchema
Instance Attribute Summary collapse
-
#indexed ⇒ Object
Returns the value of attribute indexed.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, name, indexed) ⇒ Field
constructor
-
type: type of the field in the Schema/UserSchema.
-
-
#to_json ⇒ Object
Returns the values as a json.
Methods inherited from CheckValues
#check_boolean, #check_int, #check_json, #check_string
Constructor Details
#initialize(type, name, indexed) ⇒ Field
-
type: type of the field in the Schema/UserSchema. Ex: ‘string’
-
name: name of the field in the Schema/UserSchema
-
indexed: if true, the field will be indexed on the server. That means it can be used to make a search request
89 90 91 92 93 94 95 96 |
# File 'lib/chino_ruby.rb', line 89 def initialize(type, name, indexed) check_string(type) check_string(name) check_boolean(indexed) self.type = type self.name = name self.indexed = indexed end |
Instance Attribute Details
#indexed ⇒ Object
Returns the value of attribute indexed.
84 85 86 |
# File 'lib/chino_ruby.rb', line 84 def indexed @indexed end |
#name ⇒ Object
Returns the value of attribute name.
84 85 86 |
# File 'lib/chino_ruby.rb', line 84 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
84 85 86 |
# File 'lib/chino_ruby.rb', line 84 def type @type end |
Instance Method Details
#to_json ⇒ Object
Returns the values as a json
99 100 101 |
# File 'lib/chino_ruby.rb', line 99 def to_json return {"type": type, "name": name, "indexed": indexed}.to_json end |