Module: Auctify::Behaviors
- Defined in:
 - app/models/auctify/behaviors.rb
 
Constant Summary collapse
- @@auctified_classes =
 {}
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #auctify_as(*behaviors)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Include the chosen auctify behaviors in your model:.
 
Class Method Details
.registered_classes_as(behavior) ⇒ Object
      23 24 25  | 
    
      # File 'app/models/auctify/behaviors.rb', line 23 def self.registered_classes_as(behavior) @@auctified_classes[behavior] || [] end  | 
  
Instance Method Details
#auctify_as(*behaviors) ⇒ Object
Include the chosen auctify behaviors in your model:
auctify_as :seller, :buyer
  
      12 13 14 15 16 17 18 19 20 21  | 
    
      # File 'app/models/auctify/behaviors.rb', line 12 def auctify_as(*behaviors) selected_behaviors = behaviors.map(&:to_sym).uniq selected_behaviors.each do |bhv| behavior = Auctify::Behavior::const_get(bhv.to_s.classify) # rubocop:disable Style/ColonMethodCall include behavior Rails.logger.info("Auctifiyng #{self} as #{bhv}: #{@@auctified_classes}") @@auctified_classes[bhv] = ((@@auctified_classes[bhv] || []) + [self]).sort_by { |c| c.name } end end  |