Skip to content

Finalize param can't work with &:symbol notation #13

Open
@loadkpi

Description

@loadkpi

Is it by design?

> Proc.new{|obj|obj.x}.arity
=> 1
> Proc.new(&:x).arity
=> -2
> class A < SmartCore::Operation; param :text, finalize: Proc.new{|obj|obj.x}; end
=> nil
> class A < SmartCore::Operation; param :text, finalize: proc(&:x); end
/home/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/smart_initializer-0.9.0/lib/smart_core/initializer/attribute/factory/base.rb:95:in `prepare_finalize_param': Lambda-based finalizer should have arity equal to 1 or equal to -1 (your lambda object should require one attribute) (SmartCore::Initializer::ArgumentError)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions