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.



125
126
127
128
# File 'lib/standard_config/schema.rb', line 125

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

Instance Method Details

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



130
131
132
133
134
# File 'lib/standard_config/schema.rb', line 130

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