Class: RubyClone::FromFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_clone/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}) ⇒ FromFolder

Returns a new instance of FromFolder.



6
7
8
9
10
11
# File 'lib/ruby_clone/profile.rb', line 6

def initialize(path, options = {})
  @exclude_patterns = []
  @include_patterns = []
  @options = options
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/ruby_clone/profile.rb', line 4

def path
  @path
end

Instance Method Details

#exclude_pattern=(path) ⇒ Object



13
14
15
# File 'lib/ruby_clone/profile.rb', line 13

def exclude_pattern=(path)
  @exclude_patterns << path
end

#include_pattern=(path) ⇒ Object



17
18
19
# File 'lib/ruby_clone/profile.rb', line 17

def include_pattern=(path)
  @include_patterns << path
end

#ssh?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
# File 'lib/ruby_clone/profile.rb', line 28

def ssh?
 if @options[:ssh]
   true
 else
   false
 end
end

#to_commandObject



21
22
23
24
25
26
# File 'lib/ruby_clone/profile.rb', line 21

def to_command
  command = ""
  command << @include_patterns.map { |e| "--include=#{e}" }.join(" ") + " "
  command << @exclude_patterns.map { |e| "--exclude=#{e}" }.join(" ")
  command.strip
end

#to_sObject



36
37
38
39
# File 'lib/ruby_clone/profile.rb', line 36

def to_s
  return "#{@options[:ssh]}:#{@path}" if @options[:ssh]
  return @path if not @options[:ssh]
end