Sha256: eef10bb6b622f88e6954c7f4505a1e43398166b47d261dd0fe473d6ef9c713ad
Contents?: true
Size: 1.15 KB
Versions: 12
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true 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
12 entries across 12 versions & 1 rubygems