Class: GoldenFleece::Context
- Inherits:
-
Object
- Object
- GoldenFleece::Context
- Includes:
- Export, Formats, Getters, Normalizers, Schemas
- Defined in:
- lib/golden_fleece/context.rb,
lib/golden_fleece/context/export.rb,
lib/golden_fleece/context/formats.rb,
lib/golden_fleece/context/getters.rb,
lib/golden_fleece/context/schemas.rb,
lib/golden_fleece/context/normalizers.rb
Defined Under Namespace
Modules: Export, Formats, Getters, Normalizers, Schemas
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#formats ⇒ Object
readonly
Returns the value of attribute formats.
-
#has_run_setup ⇒ Object
readonly
Returns the value of attribute has_run_setup.
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
-
#normalizers ⇒ Object
readonly
Returns the value of attribute normalizers.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#schemas ⇒ Object
readonly
Returns the value of attribute schemas.
-
#setup_callbacks ⇒ Object
readonly
Returns the value of attribute setup_callbacks.
Instance Method Summary collapse
-
#initialize(model_class) ⇒ Context
constructor
A new instance of Context.
- #run_setup_callbacks ⇒ Object
Methods included from Schemas
Methods included from Normalizers
Methods included from Getters
Methods included from Formats
Methods included from Export
Constructor Details
#initialize(model_class) ⇒ Context
Returns a new instance of Context.
19 20 21 22 23 24 25 26 27 |
# File 'lib/golden_fleece/context.rb', line 19 def initialize(model_class) @model_class = model_class @normalizers = {} @formats = {} @attributes = [] @schemas = Schema.new(self, '/', {}) @setup_callbacks = [] @has_run_setup = false end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
17 18 19 |
# File 'lib/golden_fleece/context.rb', line 17 def attributes @attributes end |
#formats ⇒ Object (readonly)
Returns the value of attribute formats.
17 18 19 |
# File 'lib/golden_fleece/context.rb', line 17 def formats @formats end |
#has_run_setup ⇒ Object (readonly)
Returns the value of attribute has_run_setup.
17 18 19 |
# File 'lib/golden_fleece/context.rb', line 17 def has_run_setup @has_run_setup end |
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class.
17 18 19 |
# File 'lib/golden_fleece/context.rb', line 17 def model_class @model_class end |
#normalizers ⇒ Object (readonly)
Returns the value of attribute normalizers.
17 18 19 |
# File 'lib/golden_fleece/context.rb', line 17 def normalizers @normalizers end |
#rules ⇒ Object
Returns the value of attribute rules.
16 17 18 |
# File 'lib/golden_fleece/context.rb', line 16 def rules @rules end |
#schemas ⇒ Object (readonly)
Returns the value of attribute schemas.
17 18 19 |
# File 'lib/golden_fleece/context.rb', line 17 def schemas @schemas end |
#setup_callbacks ⇒ Object (readonly)
Returns the value of attribute setup_callbacks.
17 18 19 |
# File 'lib/golden_fleece/context.rb', line 17 def setup_callbacks @setup_callbacks end |
Instance Method Details
#run_setup_callbacks ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/golden_fleece/context.rb', line 29 def run_setup_callbacks @setup_callbacks.each do |cb| cb.call self end @has_run_setup = true end |