Method: TkComm.list

Defined in:
lib/tk.rb

.list(val, depth = 0, enc = true) ⇒ Object

### –> definition is moved to TkUtil module

def bool(val)
  case val
  when "1", 1, 'yes', 'true'
    true
  else
    false
  end
end

def number(val)
  case val
  when /^-?\d+$/
    val.to_i
  when /^-?\d+\.?\d*(e[-+]?\d+)?$/
    val.to_f
  else
    fail(ArgumentError, "invalid value for Number:'#{val}'")
  end
end
def string(val)
  if val == "{}"
    ''
  elsif val[0] == ?{ && val[-1] == ?}
    val[1..-2]
  else
    val
  end
end
def num_or_str(val)
  begin
    number(val)
  rescue ArgumentError
    string(val)
  end
end


599
600
601
# File 'lib/tk.rb', line 599

def list(val, depth=0, enc=true)
  tk_split_list(val, depth, enc, enc)
end