# Self.\_\_send\_\_(:test\_method) passing parameter to this

**URL:** <https://www.ruby-forum.com/t/self-send-test-method-passing-parameter-to-this/171025>\
**Category:** Ruby\
**Created:** [June 25, 2009, 12:54pm UTC](https://www.ruby-forum.com/t/self-send-test-method-passing-parameter-to-this/171025 "2009-06-25T12:54:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [June 25, 2009, 12:54pm UTC](https://www.ruby-forum.com/t/self-send-test-method-passing-parameter-to-this/171025/1 "2009-06-25T12:54:25Z")

</div>

Hi  
How can I pass parameters to the method, test\_method And also would  
like to know what is \_\_ in **send**?

Thanks

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [June 25, 2009, 1:02pm UTC](https://www.ruby-forum.com/t/self-send-test-method-passing-parameter-to-this/171025/2 "2009-06-25T13:02:22Z")

</div>

Sijo Kg wrote:

> Hi  
> How can I pass parameters to the method

```
foo. __send__ (:test_method, arg1, arg2)

```

Or if the args are in an array already:

```
foo. __send__ (:test_method, *args)

```

> And also would  
> like to know what is \_\_ in **send**?

It’s two underscores 🙂

Here’s what “ri send” says:

## -------------------------------------------------------- Object# **send** obj.send(symbol [, args…]) =\> obj obj. **send** (symbol [, args…]) =\> obj

```
 Invokes the method identified by _symbol_, passing it any arguments
 specified. You can use + __send__ + if the name +send+ clashes with
 an existing method in _obj_.

    class Klass
      def hello(*args)
        "Hello " + args.join(' ')
      end
    end
    k = Klass.new
    k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
```

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [June 25, 2009, 1:21pm UTC](https://www.ruby-forum.com/t/self-send-test-method-passing-parameter-to-this/171025/3 "2009-06-25T13:21:51Z")

</div>

Hi  
Thanks for your reply
