Class: GemfileSorter::Line::Group
- Inherits:
-
BlockOfGems
- Object
- BlockOfGems
- GemfileSorter::Line::Group
- Defined in:
- lib/gemfile_sorter/line/group.rb
Instance Attribute Summary collapse
-
#names ⇒ Object
Returns the value of attribute names.
-
#sources ⇒ Object
Returns the value of attribute sources.
Attributes inherited from BlockOfGems
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #container? ⇒ Boolean
-
#initialize(*names, line:, line_number:) ⇒ Group
constructor
A new instance of Group.
- #inside_block_map ⇒ Object
- #normalized_name ⇒ Object
Methods inherited from BlockOfGems
#add, #empty?, #gem_string, #leading_spaces, #to_s
Constructor Details
Instance Attribute Details
#names ⇒ Object
Returns the value of attribute names.
4 5 6 |
# File 'lib/gemfile_sorter/line/group.rb', line 4 def names @names end |
#sources ⇒ Object
Returns the value of attribute sources.
4 5 6 |
# File 'lib/gemfile_sorter/line/group.rb', line 4 def sources @sources end |
Instance Method Details
#<=>(other) ⇒ Object
20 21 22 23 24 |
# File 'lib/gemfile_sorter/line/group.rb', line 20 def <=>(other) normalized_name <=> other.normalized_name rescue raise InvalidLineComparisonError end |
#container? ⇒ Boolean
12 |
# File 'lib/gemfile_sorter/line/group.rb', line 12 def container? = true |
#inside_block_map ⇒ Object
14 |
# File 'lib/gemfile_sorter/line/group.rb', line 14 def inside_block_map = sources |
#normalized_name ⇒ Object
16 17 18 |
# File 'lib/gemfile_sorter/line/group.rb', line 16 def normalized_name Array(names).flatten.map { _1.delete_prefix(":") }.sort.join(", ") end |