Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
Base 64 decoding a string in Ruby on Rails

I'm completely new to ruby-on-rails, I just want to write a small rb programming code that will take input as a string(encoded password), then it will decode the string and return it to the caller. I was trying the below code but not sure what I'm doing, here my purpose of having this code is to use it as a plugin in fluentd.

def create_base_64 
  
base64_string = "67382hfuisab3y289321787123890......"

decoded_data = StringIO.new(Base64.decode64(base64_string))

end

In case you are posting the code, could you please provide me with some online programming tool where I can test it online.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

#!/usr/bin/env ruby

require 'base64'

def decode_string(encoded_string)
  begin
    Base64.decode64(encoded_string)
  rescue
    puts 'Not a base64 string'
    exit
  end
end

if ARGV.length != 1
  puts 'Missing argument'
  exit
end

puts decode_string(ARGV[0])
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!