irb>> a = [ 0, 1, 2]
=> [0, 1, 2]
irb>> a.unshift('x')
=> ["x", 0, 1, 2]
# In Ruby 2.5, append and prepend are implemented as aliases to the original unshift and push methods.
a = ["hello"]
# => ["hello"]
a.append "world"
# => ["hello", "world"]
a.prepend "Hey"
# => ["Hey", "hello", "world"]
Code Example |
---|
Ruby :: rails date format dd/mm/yyyy |
Ruby :: rails add reference |
Ruby :: conditional operator in ruby |
Ruby :: auto load path rails |
Ruby :: how to json into hash ruby |
Ruby :: rails where regex |
Ruby :: ruby pop array |
Ruby :: ruby decimal to hex |
Ruby :: uper case in ruby |
Ruby :: ruby typeof |
Ruby :: super vs super() ruby |
Ruby :: rails convert unix timestamp to datetime |
Ruby :: ruby for each continue |
Ruby :: rust overwrite file |
Ruby :: rails change resource name |
Ruby :: ruby case statement multiple conditions |
Ruby :: While executing gem |
Ruby :: rails not_found |
Ruby :: ruby rails migrate check status |
Ruby :: ruby map |
Ruby :: dig method in ruby How to check whether a nested hash element exists |
Ruby :: intermediate rails project |
Ruby :: sequel ruby different table name |
Ruby :: diff between .. and ... in ruby |
Ruby :: ruby rails remove tmp/pids/server.pid |
Ruby :: OTP SMS Mobile Verification in Ruby |
Ruby :: rails loop |
R :: paste no space r |
R :: r range with step |
R :: exponent R |