Sha256: 448b14d74f0ff5f239c49b71fb3dda88ead2e220ff1f025a3a812357ae673f32
Contents?: true
Size: 1005 Bytes
Versions: 3
Compression:
Stored size: 1005 Bytes
Contents
# frozen_string_literal: true module Upgrow # The default Schema type for Basic Models. This is a specialized Schema that, # in addition to attributes, supports the definition of associations. class ModelSchema < Schema # Sets the Model Schema's initial state, with an empty Set of association # names. def initialize super @association_names = Set.new end # Define a Model association. An association is a special type of attribute # that is optional upon initialization, but it raises an Association Not # Loaded error in case its reader is called when the attribute has not been # specified when the Model was instantiated. # # @param name [Symbol] the name of the association. def association(name) @association_names += [name] end # The list of association names for this Schema. # # @return [Array<Symbol>] the list of association names. def association_names @association_names.to_a end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
upgrow-0.0.5 | lib/upgrow/model_schema.rb |
upgrow-0.0.4 | lib/upgrow/model_schema.rb |
upgrow-0.0.3 | lib/upgrow/model_schema.rb |