Now let's create a short script, let's call it `index.rb`, to fetch the block height from our node. You can copy/paste this into your code editor:
require 'ethereum.rb'
client = Ethereum::HttpClient.new('YOUR_ETHEREUM_NODE_URL')
blockNumber = client.eth_block_number
puts blockNumber["result"].to_i(16)
So go ahead and replace `ADD_YOUR_ETHEREUM_NODE_URL` with the http provider from the instructions above.
A quick explanation of the code above - we are importing the ethereum.rb gem we installed earlier (line 1), setting our Ethereum node URL (line 2), we are getting the latest Ethereum block number using client.eth_block_number API (line 3)and Printing the block number but as the API returns the block number in hexadecimal, we will convert it in decimal using to_i(16) function (lines 4).
Save this code snippet in a file index.rb we're going to run this very shortly.