Skip to content

Instantly share code, notes, and snippets.

@ramfjord
Created February 27, 2019 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramfjord/0142e2b27e0e065f9d14815c9591fbd2 to your computer and use it in GitHub Desktop.
Save ramfjord/0142e2b27e0e065f9d14815c9591fbd2 to your computer and use it in GitHub Desktop.
invoke included module from proc?
p = ->() { validates_presence_of :foo }
B = Class.new() do
include ActiveModel::Validations
p.call
end
# => NoMethodError: undefined method `validates_presence_of' for main:Object
@havenwood
Copy link

module Foo
  def wombat
    ->{ 42 }
  end
end

class Bar
  extend Foo

  wombat.call
end

#=> 42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment