Class: EasyFind::DefaultCommandMaker

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_find/default_command_maker.rb

Constant Summary collapse

SEPARATOR =
' '

Instance Method Summary collapse

Constructor Details

#initializeDefaultCommandMaker

Returns a new instance of DefaultCommandMaker.



5
6
7
8
9
# File 'lib/easy_find/default_command_maker.rb', line 5

def initialize
  @folder_clause = ''
  @where_clause = ''
  @action_clause = ''
end

Instance Method Details

#make_actions_str(&block) ⇒ Object



25
26
27
28
# File 'lib/easy_find/default_command_maker.rb', line 25

def make_actions_str(&block)
  instance_eval &block
  @action_clause
end

#make_folder_name(&block) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/easy_find/default_command_maker.rb', line 11

def make_folder_name(&block)
  folder = block.call
  if folder.is_a?(Array)
    @folder_clause = SEPARATOR + folder.join(" ")
  else
    @folder_clause = folder.nil? ? "" : (SEPARATOR + folder)
  end
end

#make_where_str(&block) ⇒ Object



20
21
22
23
# File 'lib/easy_find/default_command_maker.rb', line 20

def make_where_str(&block)
  instance_eval &block
  @where_clause
end