Class: RuboCop::Cop::Style::BisectedAttrAccessor::Macro Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/rubocop/cop/style/bisected_attr_accessor/macro.rb |
Overview
Representation of an attr_reader
, attr_writer
or attr
macro
for use by Style/BisectedAttrAccessor
.
Constant Summary
::RuboCop::Cop::VisibilityHelp
- Included
Class Method Summary
- .macro?(node) ⇒ Boolean Internal use only
- .new(node) ⇒ Macro constructor Internal use only
Instance Attribute Summary
- #all_bisected? ⇒ Boolean readonly Internal use only
- #attrs readonly Internal use only
- #bisection readonly Internal use only
- #node readonly Internal use only
- #reader? ⇒ Boolean readonly Internal use only
- #writer? ⇒ Boolean readonly Internal use only
Instance Method Summary
- #attr_names Internal use only
- #bisect(*names) Internal use only
- #bisected_names Internal use only
- #rest Internal use only
- #visibility Internal use only
::RuboCop::Cop::VisibilityHelp
- Included
Class Method Details
.macro?(node) ⇒ Boolean
Instance Attribute Details
#all_bisected? ⇒ Boolean
(readonly)
# File 'lib/rubocop/cop/style/bisected_attr_accessor/macro.rb', line 49
def all_bisected? rest.none? end
#attrs (readonly)
[ GitHub ]#bisection (readonly)
[ GitHub ]#node (readonly)
[ GitHub ]
#reader? ⇒ Boolean
(readonly)
#writer? ⇒ Boolean
(readonly)
# File 'lib/rubocop/cop/style/bisected_attr_accessor/macro.rb', line 45
def writer? node.method?(:attr_writer) end
Instance Method Details
#attr_names
[ GitHub ]# File 'lib/rubocop/cop/style/bisected_attr_accessor/macro.rb', line 29
def attr_names @attr_names ||= attrs.keys end
#bisect(*names)
[ GitHub ]# File 'lib/rubocop/cop/style/bisected_attr_accessor/macro.rb', line 25
def bisect(*names) @bisection = attrs.slice(*names).values end
#bisected_names
[ GitHub ]#rest
[ GitHub ]# File 'lib/rubocop/cop/style/bisected_attr_accessor/macro.rb', line 53
def rest @rest ||= attr_names - bisected_names end
#visibility
[ GitHub ]# File 'lib/rubocop/cop/style/bisected_attr_accessor/macro.rb', line 37
def visibility @visibility ||= node_visibility(node) end