Class: Jabara::ParseCom::Schema::Builder
- Inherits:
-
Object
- Object
- Jabara::ParseCom::Schema::Builder
- Defined in:
- lib/jabara/parse_com/schema.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Class Method Summary collapse
Instance Method Summary collapse
- #acl(user_acl_object_type:, role_acl_object_type:) ⇒ Object
- #boolean(default: nil) ⇒ Object
- #datetime(default: nil) ⇒ Object
- #file ⇒ Object
- #float(default: nil) ⇒ Object
- #id(id_key_name) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #integer(default: nil) ⇒ Object
- #json_string ⇒ Object
-
#key(key_string, type) ⇒ Object
スキーマにキーを登録する.
- #parse_object_id ⇒ Object
- #pointer ⇒ Object
- #string(max: nil, default: nil) ⇒ Object
-
#timestamp ⇒ Object
TODO def array Array.new end.
-
#type(object_type) ⇒ Object
オブジェクトのtype.
- #variants(&block) ⇒ Object
Constructor Details
Instance Attribute Details
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
237 238 239 |
# File 'lib/jabara/parse_com/schema.rb', line 237 def schema @schema end |
Class Method Details
.build(&block) ⇒ Object
239 240 241 242 243 |
# File 'lib/jabara/parse_com/schema.rb', line 239 def self.build(&block) this = self.new this.instance_eval(&block) return this.schema end |
.relation(object_type) ⇒ Object
245 246 247 248 249 250 251 |
# File 'lib/jabara/parse_com/schema.rb', line 245 def self.relation object_type self.build do type object_type key 'owningId', string key 'relatedId', string end end |
Instance Method Details
#acl(user_acl_object_type:, role_acl_object_type:) ⇒ Object
320 321 322 |
# File 'lib/jabara/parse_com/schema.rb', line 320 def acl user_acl_object_type: ,role_acl_object_type: ACL.new(user_acl_object_type: user_acl_object_type, role_acl_object_type: role_acl_object_type) end |
#boolean(default: nil) ⇒ Object
316 317 318 |
# File 'lib/jabara/parse_com/schema.rb', line 316 def boolean default: nil Boolean.new default: default end |
#datetime(default: nil) ⇒ Object
304 305 306 |
# File 'lib/jabara/parse_com/schema.rb', line 304 def datetime default: nil DateTime.new default: default end |
#file ⇒ Object
300 301 302 |
# File 'lib/jabara/parse_com/schema.rb', line 300 def file File.new end |
#float(default: nil) ⇒ Object
292 293 294 |
# File 'lib/jabara/parse_com/schema.rb', line 292 def float default: nil Float.new default: default end |
#id(id_key_name) ⇒ Object
264 265 266 |
# File 'lib/jabara/parse_com/schema.rb', line 264 def id(id_key_name) @schema.id_key_name = id_key_name end |
#integer(default: nil) ⇒ Object
288 289 290 |
# File 'lib/jabara/parse_com/schema.rb', line 288 def integer default: nil Integer.new default: default end |
#json_string ⇒ Object
324 325 326 |
# File 'lib/jabara/parse_com/schema.rb', line 324 def json_string JSONString.new end |
#key(key_string, type) ⇒ Object
スキーマにキーを登録する
269 270 271 272 |
# File 'lib/jabara/parse_com/schema.rb', line 269 def key(key_string, type) raise ArgumentError, 'key_name must be string' unless key_string.is_a? ::String (@schema.key_defs)[key_string] = type end |
#parse_object_id ⇒ Object
296 297 298 |
# File 'lib/jabara/parse_com/schema.rb', line 296 def parse_object_id ObjectId.new end |
#pointer ⇒ Object
312 313 314 |
# File 'lib/jabara/parse_com/schema.rb', line 312 def pointer Pointer.new end |
#string(max: nil, default: nil) ⇒ Object
308 309 310 |
# File 'lib/jabara/parse_com/schema.rb', line 308 def string max: nil, default: nil String.new max: max, default: default end |
#timestamp ⇒ Object
TODO def array
Array.new
end
284 285 286 |
# File 'lib/jabara/parse_com/schema.rb', line 284 def TimeStamp.new end |
#type(object_type) ⇒ Object
オブジェクトのtype
260 261 262 |
# File 'lib/jabara/parse_com/schema.rb', line 260 def type(object_type) @schema.object_type = object_type end |