Skip to content

Commit

Permalink
Make #can_lint? a bit simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
georgyangelov committed Sep 26, 2016
1 parent adeb220 commit 8da082a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/language.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
module Language
extend self

delegate :language, :parsing?, :run_tests, :extension, :solution_dump, :lint, to: :current_language
delegate :language,
:parsing?,
:run_tests,
:extension,
:solution_dump,
:can_lint?,
:lint,
to: :current_language

def current_language
@current_language ||= const_get Rails.application.config.language.to_s.camelize
Expand All @@ -22,8 +29,4 @@ def email_sender
def domain
Rails.application.config.course_domain
end

def can_lint?
current_language.respond_to? :lint
end
end
4 changes: 4 additions & 0 deletions lib/language/clojure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def extension
'clj'
end

def can_lint?
false
end

def solution_dump(attributes)
<<-END
;;; #{attributes[:name]}
Expand Down
4 changes: 4 additions & 0 deletions lib/language/go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def extension
'go'
end

def can_lint?
false
end

def solution_dump(attributes)
<<-END
// #{attributes[:name]}
Expand Down
4 changes: 4 additions & 0 deletions lib/language/python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def extension
'py'
end

def can_lint?
false
end

def solution_dump(attributes)
<<-END
# #{attributes[:name]}
Expand Down
4 changes: 4 additions & 0 deletions lib/language/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def extension
'rb'
end

def can_lint?
true
end

def solution_dump(attributes)
<<-END
# #{attributes[:name]}
Expand Down

0 comments on commit 8da082a

Please sign in to comment.