Class: NvimConf::Commenter

Inherits:
Object
  • Object
show all
Defined in:
lib/nvim_conf/commenter.rb

Class Method Summary collapse

Class Method Details

.comment_block(configuration, section, spacer: false) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/nvim_conf/commenter.rb', line 4

def comment_block(configuration, section, spacer: false)
  return if skip?(configuration)

  padded_title = section.center(20)
  border = "#" * (padded_title.length + 4)

  "    \#{spacer ? \"\\n\\n\" : \"\"}\n    -- \#{border}\n    -- # \#{padded_title} #\n    -- \#{border}\n  FORMAT\nend\n"

.skip?(configuration) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/nvim_conf/commenter.rb', line 18

def skip?(configuration)
  configuration[:format] != :lua || !configuration[:commented]
end