Module: AttrBool::Ext
- Defined in:
- lib/attr_bool.rb
Overview
Example usage: “‘ class TheTodd
extend AttrBool::Ext
attr_accessor? :headband
attr_reader? :banana_hammock
attr_writer? :high_five
attr_bool :bounce_pecs
attr_bool? :cat_fight
attr_bool! :hot_tub
end “‘
Instance Method Summary collapse
- #attr_accessor?(*names, reader: nil, writer: nil) ⇒ Boolean
- #attr_bool(*names, reader: nil, writer: nil) ⇒ Object
- #attr_bool!(*names, &writer) ⇒ Object
- #attr_bool?(*names, &reader) ⇒ Boolean
- #attr_reader?(*names, &reader) ⇒ Boolean
- #attr_writer?(*names, &writer) ⇒ Boolean
-
#extended(mod) ⇒ Object
– NOTE: Not using ‘self.` for extended/included/prepended() so that including a module that extends `AttrBool::Ext` works without having to extend `AttrBool::Ext` again.
- #included(mod) ⇒ Object
- #prepended(mod) ⇒ Object
Instance Method Details
#attr_accessor?(*names, reader: nil, writer: nil) ⇒ Boolean
80 81 82 |
# File 'lib/attr_bool.rb', line 80 def attr_accessor?(*names,reader: nil,writer: nil) return __attr_bool(names,reader: reader,writer: writer) end |
#attr_bool(*names, reader: nil, writer: nil) ⇒ Object
92 93 94 |
# File 'lib/attr_bool.rb', line 92 def attr_bool(*names,reader: nil,writer: nil) return __attr_bool(names,reader: reader,writer: writer,force_bool: true) end |
#attr_bool!(*names, &writer) ⇒ Object
100 101 102 |
# File 'lib/attr_bool.rb', line 100 def attr_bool!(*names,&writer) return __attr_bool(names,writer: writer,force_bool: true) end |
#attr_bool?(*names, &reader) ⇒ Boolean
96 97 98 |
# File 'lib/attr_bool.rb', line 96 def attr_bool?(*names,&reader) return __attr_bool(names,reader: reader,force_bool: true) end |
#attr_reader?(*names, &reader) ⇒ Boolean
84 85 86 |
# File 'lib/attr_bool.rb', line 84 def attr_reader?(*names,&reader) return __attr_bool(names,reader: reader) end |
#attr_writer?(*names, &writer) ⇒ Boolean
88 89 90 |
# File 'lib/attr_bool.rb', line 88 def attr_writer?(*names,&writer) return __attr_bool(names,writer: writer) end |
#extended(mod) ⇒ Object
– NOTE: Not using ‘self.` for extended/included/prepended() so that including a module that extends
`AttrBool::Ext` works without having to extend `AttrBool::Ext` again.
++
65 66 67 68 |
# File 'lib/attr_bool.rb', line 65 def extended(mod) super __attr_bool_extended(mod) end |
#included(mod) ⇒ Object
70 71 72 73 |
# File 'lib/attr_bool.rb', line 70 def included(mod) super __attr_bool_extended(mod) end |
#prepended(mod) ⇒ Object
75 76 77 78 |
# File 'lib/attr_bool.rb', line 75 def prepended(mod) super __attr_bool_extended(mod) end |