smart_properties icon indicating copy to clipboard operation
smart_properties copied to clipboard

Ruby accessors on steroids

Results 16 smart_properties issues
Sort by recently updated
recently updated
newest added

Extracts the behaviour of the runtime into various plugins. **Next steps** - [ ] Refactor the runtime to use the plugins - [ ] Create a new runtime that's simply...

Given a property defined as follows: ```ruby class Foo include SmartProperties property :bar, required: true, default: true end ``` The following code works, as expected: ```ruby Foo.new # => #...

...and `#size` and `#length`, to match `Hash`. Since I added `Forwardable` anyway, we can use it to replace the manual definition of `#values`

Use symbols instead of strings to store property names. In modern Ruby implementations, symbols are garbage collected.

It looks like previously, any kind of `Enumerable` was allowed as an argument to `accepts:`, but it has since been constrained so that any non-`Proc` values are transformed into an...

Add support for automatically protecting writer methods when defining a property. Read-only properties should be writeable during during object initialization, but once the initializer is finished they should only be...

feature

In order to attach additional behaviour whenever a property gets read or written, the index methods `#[]` and `#[]=` should be used for calling `Property#get` and `Property#set` as opposed to...

For example: ```Ruby property :types, converts: ->(v) { Array(v).map(&:to_s) }, alias: :type ```

In some scenarios, it might be necessary to perform validation before performing the conversion. This is currently unsupported.

feature

The README should contain a section about how to override getters and setters.

documentation