code-quality

Binary to Octal Evaluation

binary to octal evaluation

ruby
Binary to Octal Evaluation

This is another thing I learned while watching ruby-tapas video on binary literals. Length of the video was 1m:47s only and I am already writing second blog about the learnings from there!

In this post, we will see binary to octal conversion as shown in the video.

# U  G  O
# rwxrwxrwx
0b111101101
 
perms = 0b111101101
perms.to_s(8) # => "755"

I will surely add other ways of achieving the same as I find in future. I know you are another wise rubyist there, feel free to share your knowledge in the comments below.

Happy Learning! :)

Press Esc to return to the article
About the author

Prakash Poudel Sharma

Independent product manager & agentic engineering consultant

I'm an independent product manager, founder, and software builder based in Kathmandu. I help teams make product decisions and adopt agentic software development, drawing on over a decade of building software. I write about product thinking, engineering with AI, and hands-on experiments.

Keep reading

More on this

Join the conversation0 comments

What did you take away?

Thoughts, pushback, or a story of your own? Drop a reply below — I read every one.

Comments are powered by Disqus. By posting you agree to theirterms.

—
0:000:00