This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChainMethod | |
def initialize(method_name, params = [], callbacks = {}) | |
@method_name = method_name | |
@params = params | |
@callbacks = callbacks | |
end | |
def call(base_object) | |
# preparation work | |
result = base_object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'clickworker-secure-config/helper'; include Clickworker::SecureConfig::Helper | |
# Be sure to restart your server when you modify this file. | |
# Your secret key for verifying the integrity of signed cookies. | |
# If you change this key, all old signed cookies will become invalid! | |
# Make sure the secret is at least 30 characters and all random, | |
# no regular words or you'll be exposed to dictionary attacks. | |
ClickworkerProfile::Application.config.secret_token = get_secret_by_key('profile.secret_token') || 'd69b09956e0ccef4351f239dcbbc3265' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ~ » irb | |
1.9.3p286 :001 > class A | |
1.9.3p286 :002?> def to_modify | |
1.9.3p286 :003?> "Not modified" | |
1.9.3p286 :004?> end | |
1.9.3p286 :005?> end | |
=> nil | |
1.9.3p286 :006 > def redefine_method(klass, &block) | |
1.9.3p286 :007?> if klass.new.respond_to?(:to_modify) | |
1.9.3p286 :008?> klass.send(:define_method, :to_modify, &block) |