class RealPage::Model::Base::AttributeStore
Hold attributes defined with the DSL in Models
Attributes
attributes[R]
model_class[R]
Public Class Methods
new(model_class)
click to toggle source
# File lib/real_page/model/base/attribute_store.rb, line 8 def initialize(model_class) @model_class = model_class @attributes = [] end
Public Instance Methods
add(type, attrs)
click to toggle source
Add all attributes of the same type to the AttributeStore
# File lib/real_page/model/base/attribute_store.rb, line 14 def add(type, attrs) attrs.map do |attr| attribute = Attribute.new(prefix: prefix, type: type, name: attr) @attributes << attribute attribute end end
find(attr)
click to toggle source
Find a specific attribute with the given name
# File lib/real_page/model/base/attribute_store.rb, line 23 def find(attr) attributes.detect { |attribute| attribute.matches?(attr) } end
Private Instance Methods
prefix()
click to toggle source
# File lib/real_page/model/base/attribute_store.rb, line 31 def prefix model_class.name.split('::').last.downcase end