Attr_extras

screenshot of Attr_extras

Takes some boilerplate out of Ruby with methods like attr_initialize.

Overview

This product is a gem for Ruby called attr_extras. It aims to simplify and streamline certain aspects of Ruby programming by providing lower-level and higher-level methods that complement Ruby's built-in attr_accessor, attr_reader, and attr_writer. It also offers conveniences for creating value objects, method objects, query methods, and abstract methods.

Features

  • attr_private and attr_value: Provides lower-level methods like attr_private and attr_value that nicely complement Ruby's built-in attr_accessor, attr_reader, and attr_writer.
  • pattr_initialize and method_object: Offers higher-level methods like pattr_initialize (or attr_private_initialize) and method_object to reduce boilerplate in the code.
  • Support for positional and keyword arguments: Supports positional arguments as well as optional and required keyword arguments.
  • Conveniences for creating value objects, method objects, query methods, and abstract methods: Provides conveniences for creating value objects, method objects, query methods, and abstract methods.

Summary

The attr_extras gem is a helpful tool for Ruby developers, providing additional methods that simplify certain aspects of Ruby programming. It offers lower-level and higher-level methods that complement Ruby's built-in attr_accessor, attr_reader, and attr_writer, reducing boilerplate code and improving readability. It also supports various types of arguments and provides conveniences for creating value objects, method objects, query methods, and abstract methods.