Module: Skywalker::Acceptable
- Defined in:
- lib/skywalker/acceptable.rb
Class Method Summary collapse
-
.included(klass) ⇒ Object
Creates an ‘_args` accessor on inclusion.
Instance Method Summary collapse
-
#initialize(**args) {|_self| ... } ⇒ Object
Instantiates an object, setting all kwargs as accessors, and yields self to any block given.
Class Method Details
.included(klass) ⇒ Object
Creates an ‘_args` accessor on inclusion.
9 10 11 |
# File 'lib/skywalker/acceptable.rb', line 9 def self.included(klass) klass.send(:attr_accessor, :_args) end |
Instance Method Details
#initialize(**args) {|_self| ... } ⇒ Object
Instantiates an object, setting all kwargs as accessors, and yields self to any block given.
20 21 22 23 24 25 26 27 28 |
# File 'lib/skywalker/acceptable.rb', line 20 def initialize(**args) self._args = args self._args.freeze validate_arguments! parse_arguments yield self if block_given? end |