Class: Playgroundbook::Linter
- Inherits:
-
AbstractLinter
- Object
- AbstractLinter
- Playgroundbook::Linter
- Defined in:
- lib/linter/playgroundbook_lint.rb
Overview
A linter for verifying a playground book
Instance Attribute Summary collapse
-
#contents_linter ⇒ Object
Returns the value of attribute contents_linter.
-
#playground_file_name ⇒ Object
Returns the value of attribute playground_file_name.
Instance Method Summary collapse
- #contents_dir_exists? ⇒ Boolean
-
#initialize(playground_file_name, contents_linter = ContentsLinter.new) ⇒ Linter
constructor
A new instance of Linter.
- #lint ⇒ Object
Methods inherited from AbstractLinter
Constructor Details
#initialize(playground_file_name, contents_linter = ContentsLinter.new) ⇒ Linter
Returns a new instance of Linter.
12 13 14 15 |
# File 'lib/linter/playgroundbook_lint.rb', line 12 def initialize(playground_file_name, contents_linter = ContentsLinter.new) @playground_file_name = playground_file_name @contents_linter = contents_linter end |
Instance Attribute Details
#contents_linter ⇒ Object
Returns the value of attribute contents_linter.
10 11 12 |
# File 'lib/linter/playgroundbook_lint.rb', line 10 def contents_linter @contents_linter end |
#playground_file_name ⇒ Object
Returns the value of attribute playground_file_name.
9 10 11 |
# File 'lib/linter/playgroundbook_lint.rb', line 9 def playground_file_name @playground_file_name end |
Instance Method Details
#contents_dir_exists? ⇒ Boolean
27 28 29 |
# File 'lib/linter/playgroundbook_lint.rb', line 27 def contents_dir_exists? Dir.exist?(playground_file_name + "/Contents") end |
#lint ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/linter/playgroundbook_lint.rb', line 17 def lint "Validating #{playground_file_name.yellow}..." fail_lint "No Contents directory" unless contents_dir_exists? Dir.chdir playground_file_name do contents_linter.lint end end |