Sha256: b3eb8ddd9f4221cafbade893ce172c344e96b8357078878d673d2a650ff183cd
Contents?: true
Size: 1.14 KB
Versions: 44
Compression:
Stored size: 1.14 KB
Contents
# encoding: utf-8 module RailsBestPractices module Core # Model attributes container. class ModelAttributes def initialize @attributes = {} end # Add a model attribute. # # @param [String] model name # @param [String] attribute name # @param [String] attribute type def add_attribute(model_name, attribute_name, attribute_type) @attributes[model_name] ||= {} @attributes[model_name][attribute_name] = attribute_type end # Get attribute type. # # @param [String] model name # @param [String] attribute name # @return [String] attribute type def get_attribute_type(model_name, attribute_name) @attributes[model_name] ||= {} @attributes[model_name][attribute_name] end # If it is a model's attribute. # # @param [String] model name # @param [String] attribute name # @return [Boolean] true if it is the model's attribute def is_attribute?(model_name, attribute_name) @attributes[model_name] ||= {} !!@attributes[model_name][attribute_name] end end end end
Version data entries
44 entries across 44 versions & 2 rubygems