When I create a new object, it seems to have a "value", a representation that for example resides in a hash:

```
h = { str: String.new("asd") }  # => {:str=>"asd"}

```

or just in irb:

```
String.new("asd")
 => "asd"

```

How is that done? What is this "asd"?

When I create my own class:

```
class A; def initalize(varl); end; end;
a = A.new("asd")
 => #<A:0x007fab7c2fe250>

```

What is that "#"? What I want is an object inside a hash, that, for example, behaves like a string. Like this:

```
hash = {str: A.new("asd")}
hash[:str]  # => "asd"
hash[:str].my_method   

```

How can I do that? I don't want to inherit from String. I want to do this for some other types with other representations too.

Update:

What i really want to do is to build a Hash where the keys and the values are "some kind of" Integers, Strings and Arrays but have my own defined methods:

```
hash = {a: MyArray.new([:x,:y]), b: MyString.new("asdasd")}
hash[:a] # => [:x,:y]
hash[:b] # => "asdasd"
hash[:b].my_method

```

In fact, the hash should be serializable for ActiveRecord.

//Edit:
I found out what i acutally searched for:

There is no "value" in genereal. What i looked for in my question was the behaviour of an object in terms of some methods. 

If i want any general object to behave "like an array", in my mind there were things that i thought of:
- accessing contents via array[] and array << entry and array.push(entry) or array.map{block}. 

And i found out that is very bad to just inherit from Array. A much better apporach is to use forwardable and and forward these methods to an attribute of that object. 

For example:

```
class Answer::Array
  attr_accessor :value

  extend Forwardable

  def_delegator :@value, :inspect
  def_delegator :@value, :to_s
  def_delegator :@value, :[]
  def_delegator :@value, :[]=
  def_delegator :@value, :each
  def_delegator :@value, :map

  def initlialize
    @value = []
  end

  def my_method
    some_code
  end
end

```

So to let an object behave like any other "primitive" object, just use Forwardable to delegate methods to a value object.