Sha256: 71305ace89f9e972928d6142acb742c6024dc66d7698a033c6548d7c2fd173e0
Contents?: true
Size: 764 Bytes
Versions: 3
Compression:
Stored size: 764 Bytes
Contents
module Exposant class ModelExhibitor < SimpleDelegator include Exhibitor extend ActiveModel::Naming def to_model obj end def self.human_attribute_name(*args) exhibited_class.human_attribute_name(*args) end def self.exhibited_class return ancestors[1].exhibited_class unless ancestors[1] == ModelExhibitor name.gsub(/Exhibitor$/, '').constantize end def self.exhibitor_variant variant = name[parent_exhibitor.exhibited_class.name.length..].gsub(/Exhibitor$/, '').downcase return nil if variant.blank? variant.to_sym end def self.parent_exhibitor return ancestors[1].parent_exhibitor unless ancestors[1] == ModelExhibitor name.constantize end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
exposant-0.1.2 | lib/exposant/model_exhibitor.rb |
exposant-0.1.1 | lib/exposant/model_exhibitor.rb |
exposant-0.1.0 | lib/exposant/model_exhibitor.rb |