Class: PropertySynthesizeDealloc

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file_path = '') ⇒ PropertySynthesizeDealloc

Returns a new instance of PropertySynthesizeDealloc.



13
14
15
16
17
18
19
20
21
# File 'lib/property_synthesize_dealloc.rb', line 13

def initialize(config_file_path='')
  Configuration.new(config_file_path)

  @sleep_time = Configuration.settings['sleep_time']
  @xcode      = app(Configuration.settings['xcode_app_path'])
  @logging    = false

  set_file_path
end

Instance Attribute Details

#config_pathObject

Returns the value of attribute config_path.



11
12
13
# File 'lib/property_synthesize_dealloc.rb', line 11

def config_path
  @config_path
end

#file_pathObject

Returns the value of attribute file_path.



11
12
13
# File 'lib/property_synthesize_dealloc.rb', line 11

def file_path
  @file_path
end

#header_file_pathObject

Returns the value of attribute header_file_path.



11
12
13
# File 'lib/property_synthesize_dealloc.rb', line 11

def header_file_path
  @header_file_path
end

#loggingObject

Returns the value of attribute logging.



11
12
13
# File 'lib/property_synthesize_dealloc.rb', line 11

def logging
  @logging
end

#m_file_pathObject

Returns the value of attribute m_file_path.



11
12
13
# File 'lib/property_synthesize_dealloc.rb', line 11

def m_file_path
  @m_file_path
end

#selectionObject

Returns the value of attribute selection.



11
12
13
# File 'lib/property_synthesize_dealloc.rb', line 11

def selection
  @selection
end

#xcodeObject

Returns the value of attribute xcode.



11
12
13
# File 'lib/property_synthesize_dealloc.rb', line 11

def xcode
  @xcode
end

Instance Method Details

#convert_selectionObject



40
41
42
43
44
# File 'lib/property_synthesize_dealloc.rb', line 40

def convert_selection
  converter = Converter.new(@selection)
  converter.convert
  converter
end

#psd!Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/property_synthesize_dealloc.rb', line 23

def psd!
  log "Selection:\n#{@selection}"
  selection_check
  file_check

  converter        = convert_selection
  content_replacer = ContentReplacer.new(converter)
  header_content   = content_replacer.header_content(@header_file_path)
  m_content        = content_replacer.m_content(@m_file_path)

  # Update the files!
  replace_file_content(@header_file_path, header_content)
  replace_file_content(@m_file_path, m_content)
  save_file(@header_content)
  save_file(@m_file_path)
end