Class: Reposit::SetupChecker
- Inherits:
-
Object
- Object
- Reposit::SetupChecker
- Defined in:
- lib/reposit.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
Returns the value of attribute lines.
Class Method Summary collapse
Instance Method Summary collapse
- #both_lines_have_text? ⇒ Boolean
- #check ⇒ Object
- #file_exists? ⇒ Boolean
- #has_two_lines? ⇒ Boolean
-
#initialize ⇒ SetupChecker
constructor
A new instance of SetupChecker.
Constructor Details
#initialize ⇒ SetupChecker
Returns a new instance of SetupChecker.
59 60 61 |
# File 'lib/reposit.rb', line 59 def initialize @lines = 0 end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
57 58 59 |
# File 'lib/reposit.rb', line 57 def lines @lines end |
Class Method Details
.check ⇒ Object
63 64 65 |
# File 'lib/reposit.rb', line 63 def self.check new.check end |
Instance Method Details
#both_lines_have_text? ⇒ Boolean
84 85 86 |
# File 'lib/reposit.rb', line 84 def both_lines_have_text? lines.all? {|line| line && line.size > 0} end |
#check ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/reposit.rb', line 67 def check if file_exists? has_two_lines? && both_lines_have_text? else false end end |
#file_exists? ⇒ Boolean
75 76 77 |
# File 'lib/reposit.rb', line 75 def file_exists? File.exist?(File.('~') + '/.reposit') end |
#has_two_lines? ⇒ Boolean
79 80 81 82 |
# File 'lib/reposit.rb', line 79 def has_two_lines? self.lines = Reposit::CredentialsReader.new.get_credentials lines.size == 2 end |