Method: JQuery::Object#to_s

Defined in:
lib/jquery.rb

#to_sObject Also known as: to_str



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/jquery.rb', line 34

def to_s
  current = self
  chain   = [current]

  while current.prev
    current = current.prev
    chain.unshift(current)
  end

  result = []
  chain.map do |obj|
    expr = ''
    expr << "#{obj.label}("
    expr << obj.args.map { |arg| arg.to_s }.join(',')
    expr << ')'
    result << expr
  end

  result.join('.')
end