Class: StandardConfig::Schema::ScopedScope

Inherits:
Object
  • Object
show all
Defined in:
lib/standard_config/schema.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema, scope_name) ⇒ ScopedScope

Returns a new instance of ScopedScope.



127
128
129
130
# File 'lib/standard_config/schema.rb', line 127

def initialize(schema, scope_name)
  @schema = schema
  @scope_name = scope_name
end

Instance Method Details

#field(name, type: :string, default: nil, readonly: false) ⇒ Object



132
133
134
135
136
# File 'lib/standard_config/schema.rb', line 132

def field(name, type: :string, default: nil, readonly: false)
  # Add field to the last declared scope by using ScopeBuilder within @schema.scope
  # This method will be called inside Schema.scope block via Drawer
  @schema.scopes[@scope_name].field(name, type: type, default: default, readonly: readonly)
end