Sha256: 7ee1c2a13dbfc807dfcf48fea08d16796a31111b2fb7a4530c109fcfc18378b0
Contents?: true
Size: 855 Bytes
Versions: 3
Compression:
Stored size: 855 Bytes
Contents
require_relative 'attribute' module Amsi module Model class Base # Hold attributes defined with the DSL in Models class AttributeStore def initialize(model_class) @model_class = model_class @attributes = [] end # Add all attributes of the same type to the AttributeStore def add(type, attrs) attrs.map do |attr| attribute = Attribute.new(prefix: prefix, type: type, name: attr) @attributes << attribute attribute end end # Find a specific attribute with the given name def find(attr) attributes.detect { |attribute| attribute.matches?(attr) } end private attr_reader :attributes, :model_class def prefix '' end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
amsi-1.1.0 | lib/amsi/model/base/attribute_store.rb |
amsi-1.0.1 | lib/amsi/model/base/attribute_store.rb |
amsi-1.0.0 | lib/amsi/model/base/attribute_store.rb |