Class: Meta::JsonSchema::ObjectSchemaBuilder::Locked

Inherits:
Object
  • Object
show all
Includes:
LockedMethodAlias
Defined in:
lib/meta/json_schema/builders/object_schema_builder.rb

Defined Under Namespace

Modules: LockedMethodAlias

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LockedMethodAlias

#add_scope, #lock, #method_missing

Constructor Details

#initialize(builder, **locked_options) ⇒ Locked

locked_options 是用户传递的参数,这个参数会被合并到 object_schema_builder 的 locked_options 中。



39
40
41
42
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 39

def initialize(builder, **locked_options)
  @object_schema_builder = builder
  @locked_options = SchemaOptions::UserOptions::Filter.check(locked_options.compact)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Meta::JsonSchema::ObjectSchemaBuilder::Locked::LockedMethodAlias

Instance Attribute Details

#locked_optionsObject (readonly)

Returns the value of attribute locked_options.



36
37
38
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 36

def locked_options
  @locked_options
end

#object_schema_builderObject (readonly)

Returns the value of attribute object_schema_builder.



36
37
38
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 36

def object_schema_builder
  @object_schema_builder
end

Instance Method Details

#locked(options) ⇒ Object



48
49
50
51
52
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 48

def locked(options)
  options = SchemaOptions::UserOptions::Filter.check(options)
  options = ObjectSchema.merge_user_options(locked_options, options)
  Locked.new(self.object_schema_builder, **options)
end

#to_schemaObject



44
45
46
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 44

def to_schema
  object_schema_builder.to_schema(locked_options)
end