+ "!" end end original = ->(s) { s.shout } refined = original.refined(StringExt) p refined.call("hello") # "HELLO!" p original.call("hello") # NoMethodError
super unless block super(to_arel_condition(evaluate_block(&block))) end def evaluate_block(&block) refined_block = block.refined(ActiveRecord::Refined::BlockSyntax) BlockContext.new(model).instance_exec(&refined_block) end
:updated_at == :created_at } # ArgumentError if a symbol is not a column where { :status == :active } # An enum value is its string where { :status == "active" }