Skip to content

Welcome to Tech by Example

Menu
  • Home
  • Posts
  • System Design Questions
Menu

Tag: ruby

Ruby Regex or Regular Expression in a variable

Posted on August 12, 2021August 12, 2021 by admin

Overview In Ruby, a regular expression is defined between two forward slashes. This is a way to differentiate a regular expression from a normal string. This is how a regex will be…

JSON parse a file or string in Ruby Language

Posted on August 7, 2021August 7, 2021 by admin

Overview json module of ruby can be used a JSON parse a file or string in ruby language https://ruby-doc.org/stdlib-2.6.3/libdoc/json/rdoc/JSON.html It provides a parse function that can be used to parse a file….

Run Ruby language code in command line or terminal – Single-line and Multiline

Posted on August 7, 2021August 7, 2021 by admin

Overview It is possible to run a ruby code directly on a command line or the terminal itself.  We need to pass the -e flag. This is the syntax for the same…

Get full hostname and port from a URL in Ruby Language

Posted on July 26, 2021July 26, 2021 by admin

Overview URI module of ruby can be used to get all parts from a URL.  This module can be used to parse a URL and extract all parts https://ruby-doc.org/stdlib-2.5.1/libdoc/uri/rdoc/URI.html Once the given…

Convert Query Param String to Query Param Hash in Ruby Language

Posted on July 23, 2021July 23, 2021 by admin

Overview Assume we have below query param string We want the output as Program Below is the program for the same Output

Extract a URL from a string in Ruby Language

Posted on July 23, 2021July 23, 2021 by admin

Overview URI module can be used to extract URL from a given string https://ruby-doc.org/stdlib-2.5.1/libdoc/uri/rdoc/URI.html We can use the Extract method of the URI module https://ruby-doc.org/stdlib-2.5.1/libdoc/uri/rdoc/URI.html#method-c-extract Below is the signature of the method…

Parse a URL and extract all the parts in Ruby Language

Posted on July 23, 2021July 23, 2021 by admin

Overview URI module can be used to parse a URL and extract all parts https://ruby-doc.org/stdlib-2.5.1/libdoc/uri/rdoc/URI.html Once the given URL is parsed correctly, then it will return the URI object. We can then…

©2025 Welcome to Tech by Example | Design: Newspaperly WordPress Theme
Menu
  • Home
  • Posts
  • System Design Questions