Sha256: ea77714172893781fcbfcab2d9460b24d86f2e76b492d891729ae9f3df3a02ed

Contents?: true

Size: 303 Bytes

Versions: 8

Compression:

Stored size: 303 Bytes

Contents

class PopularModelWithCallbacks < PopularModel
  [:after, :before].each do |filter|
    [:befriend, :unfriend].each do |action|
      hook = "#{filter}_#{action}".to_sym
      method_name = "#{hook}_callback".to_sym

      send hook, method_name

      define_method method_name, ->{}
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
popular-0.7.4 spec/support/popular_model_with_callbacks.rb
popular-0.7.3 spec/support/popular_model_with_callbacks.rb
popular-0.7.2 spec/support/popular_model_with_callbacks.rb
popular-0.7.1 spec/support/popular_model_with_callbacks.rb
popular-0.7.0 spec/support/popular_model_with_callbacks.rb
popular-0.6.0 spec/support/popular_model_with_callbacks.rb
popular-0.5.1 spec/support/popular_model_with_callbacks.rb
popular-0.5.0 spec/support/popular_model_with_callbacks.rb