Class: Meta::JsonSchema::ObjectSchemaBuilder::WithCommonOptions
- Inherits:
-
Object
- Object
- Meta::JsonSchema::ObjectSchemaBuilder::WithCommonOptions
- Defined in:
- lib/meta/json_schema/builders/object_schema_builder.rb
Instance Attribute Summary collapse
-
#common_options ⇒ Object
readonly
Returns the value of attribute common_options.
-
#object_schema_builder ⇒ Object
readonly
Returns the value of attribute object_schema_builder.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(builder, common_options) ⇒ WithCommonOptions
constructor
A new instance of WithCommonOptions.
- #merge_options(options) ⇒ Object
- #property(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize(builder, common_options) ⇒ WithCommonOptions
Returns a new instance of WithCommonOptions.
59 60 61 62 63 64 |
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 59 def initialize(builder, , &) @object_schema_builder = builder @common_options = instance_exec(&) if block_given? end |
Instance Attribute Details
#common_options ⇒ Object (readonly)
Returns the value of attribute common_options.
57 58 59 |
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 57 def @common_options end |
#object_schema_builder ⇒ Object (readonly)
Returns the value of attribute object_schema_builder.
57 58 59 |
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 57 def object_schema_builder @object_schema_builder end |
Class Method Details
.merge_options(common_options, options) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 75 def self.(, ) .merge() do |key, oldVal, newVal| if key == :scope # 合并 common_options 和 options 中的 scope 选项 Scope::Utils.and(oldVal, newVal) else # 关于 param、render 内部选项的合并问题暂不考虑 newVal end end end |
Instance Method Details
#merge_options(options) ⇒ Object
71 72 73 |
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 71 def () self.class.(, ) end |
#property(name, options = {}, &block) ⇒ Object
66 67 68 69 |
# File 'lib/meta/json_schema/builders/object_schema_builder.rb', line 66 def property(name, = {}, &block) = () object_schema_builder.property(name, , &block) end |