Class: Poper2::Rule::CharacterLimit

Inherits:
Rule
  • Object
show all
Defined in:
lib/poper2/rule/character_limit.rb

Instance Method Summary collapse

Methods inherited from Rule

all, inherited, #initialize

Constructor Details

This class inherits a constructor from Poper2::Rule::Rule

Instance Method Details

#check(message) ⇒ Object



4
5
6
7
8
# File 'lib/poper2/rule/character_limit.rb', line 4

def check(message)
  error_message if message.lines.any? do |line|
    line.chomp.length > character_limit
  end
end

#enabled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/poper2/rule/character_limit.rb', line 10

def enabled?
  @config.character_limit_enabled.to_s == 'true'
end