Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6577001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:34:52+00:00 2026-05-25T15:34:52+00:00

Is it possible not to assign context to lambda? For example: class Rule def

  • 0

Is it possible not to assign context to lambda?

For example:

class Rule
  def get_rule
    return lambda {puts name}
  end
end

class Person
  attr_accessor :name

  def init_rule 
    @name = "ruby"
    Rule.new.get_rule.call() # should say "ruby" but say what object of class Rull, does not have variable name
    # or self.instance_eval &Rule.new.get_rule
  end
end

My target is -> stored procedure objects without contexts, and assign context before call in specific places. Is it possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:34:53+00:00Added an answer on May 25, 2026 at 3:34 pm

    Yeah, but be careful with it, this one is really easy to abuse. I would personally be apprehensive of code like this.

    class Rule
      def get_rule
        Proc.new { puts name }
      end
    end
    
    class Person
      attr_accessor :name
    
      def init_rule 
        @name = "ruby"
        instance_eval(&Rule.new.get_rule)
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably not possible, but I have this class: public class Metadata<DataType> where
Possible Duplicate: delegate not being called I declared a delegate in my appdelegate class,
It is not possible to check out a single file. The finest level of
It is not possible to fire an event in C# that has no handlers
I was wondering if it is possible to not attach Excel sheet if it
Does anyone know if it's possible to not use the navigation properties feature of
The Java documentation says: it is not possible for two invocations of synchronized methods
I am pretty sure this is possible just not sure what is the term
As far as i know it is not possible to do the following in
Am I doing something wrong or is it not possible to specify a generic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.