Class: ChinoRuby::Field
- Inherits:
-
CheckValues
- Object
- CheckValues
- ChinoRuby::Field
- Defined in:
- lib/chino_ruby/classes.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
43 44 45 46 47 48 49 50 |
# File 'lib/chino_ruby/classes.rb', line 43 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.
38 39 40 |
# File 'lib/chino_ruby/classes.rb', line 38 def indexed @indexed end |
#name ⇒ Object
Returns the value of attribute name.
38 39 40 |
# File 'lib/chino_ruby/classes.rb', line 38 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
38 39 40 |
# File 'lib/chino_ruby/classes.rb', line 38 def type @type end |
Instance Method Details
#to_json ⇒ Object
Returns the values as a json
53 54 55 |
# File 'lib/chino_ruby/classes.rb', line 53 def to_json return {"type": type, "name": name, "indexed": indexed}.to_json end |