Module: T::Props::ClassMethods
- Defined in:
- lib/sorbet/eraser/t/props.rb
Overview
Here we’re implementing a very basic version of the prop/const methods that are in sorbet-runtime. These are only here to allow consumers to call them and not raise errors and for bookkeeping.
Instance Method Summary collapse
Instance Method Details
#const(name, rules = {}) ⇒ Object
27 28 29 30 |
# File 'lib/sorbet/eraser/t/props.rb', line 27 def const(name, rules = {}) create_prop(name, rules) attr_reader(name) unless rules[:without_accessors] end |
#prop(name, rules = {}) ⇒ Object
22 23 24 25 |
# File 'lib/sorbet/eraser/t/props.rb', line 22 def prop(name, rules = {}) create_prop(name, rules) attr_accessor(name) unless rules[:without_accessors] end |
#props ⇒ Object
18 19 20 |
# File 'lib/sorbet/eraser/t/props.rb', line 18 def props @props ||= {} end |