Class: Codewars::Description
- Inherits:
-
Thor::Shell::Basic
- Object
- Thor::Shell::Basic
- Codewars::Description
- Defined in:
- lib/codewars/description.rb
Constant Summary collapse
- DESCRIPTION_FILE_NAME =
'description.md'
Instance Method Summary collapse
Instance Method Details
#print_kata_desc(kata) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/codewars/description.rb', line 14 def print_kata_desc(kata) print_parameter('Name', kata.name) print_parameter('Link', "#{CODEWARS_URL}#{kata.href}") print_parameter('Description', kata.description) print_parameter('Tags', kata..join(', ')) if kata. print_parameter('Rank', kata.rank.to_s) if kata.rank say '' print_parameter('Type to start this kata', "codewars train #{kata.slug}", :blue, true) end |
#take_value_from_file(regex_with_group, param_key) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/codewars/description.rb', line 5 def take_value_from_file(regex_with_group, param_key) @data ||= read_file(DESCRIPTION_FILE_NAME) param = @data.match(regex_with_group) unless param fail Thor::Error, "'#{param_key}' has not been found in the 'description.md' file." end param[1] end |