Class: IOSGenerateSettings
- Inherits:
-
Object
- Object
- IOSGenerateSettings
- Defined in:
- lib/ios_generate_settings.rb
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#header_replacer ⇒ Object
Returns the value of attribute header_replacer.
-
#property_list ⇒ Object
Returns the value of attribute property_list.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_replacer ⇒ Object
Returns the value of attribute source_replacer.
-
#template_header ⇒ Object
Returns the value of attribute template_header.
-
#template_source ⇒ Object
Returns the value of attribute template_source.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(args) ⇒ IOSGenerateSettings
constructor
A new instance of IOSGenerateSettings.
- #usage ⇒ Object
Constructor Details
#initialize(args) ⇒ IOSGenerateSettings
Returns a new instance of IOSGenerateSettings.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ios_generate_settings.rb', line 13 def initialize(args) if args.count == 0 usage else self.header = "SettingsManager.h" self.source = "SettingsManager.m" template_path = File.(File.join(File.dirname(__FILE__), 'ios_generate_settings/templates')) self.template_source = File.join(template_path, 'SettingsManager.m.template') self.template_header = File.join(template_path, 'SettingsManager.h.template') self.source_replacer = ObjCPropertyReplacer.new self.template_source, self.source self.header_replacer = ObjCPropertyReplacer.new self.template_header, self.header self.property_list = ObjCPropertyList.new args end end |
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header.
5 6 7 |
# File 'lib/ios_generate_settings.rb', line 5 def header @header end |
#header_replacer ⇒ Object
Returns the value of attribute header_replacer.
10 11 12 |
# File 'lib/ios_generate_settings.rb', line 10 def header_replacer @header_replacer end |
#property_list ⇒ Object
Returns the value of attribute property_list.
11 12 13 |
# File 'lib/ios_generate_settings.rb', line 11 def property_list @property_list end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/ios_generate_settings.rb', line 6 def source @source end |
#source_replacer ⇒ Object
Returns the value of attribute source_replacer.
9 10 11 |
# File 'lib/ios_generate_settings.rb', line 9 def source_replacer @source_replacer end |
#template_header ⇒ Object
Returns the value of attribute template_header.
7 8 9 |
# File 'lib/ios_generate_settings.rb', line 7 def template_header @template_header end |
#template_source ⇒ Object
Returns the value of attribute template_source.
8 9 10 |
# File 'lib/ios_generate_settings.rb', line 8 def template_source @template_source end |
Instance Method Details
#generate ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ios_generate_settings.rb', line 27 def generate self.header_replacer.replace("//string_constants", self.property_list.string_const) self.header_replacer.replace("//property_declaration", self.property_list.declaration) self.header_replacer.flush self.source_replacer.replace("//property_implementation", self.property_list.implementation) self.source_replacer.replace("//load_properties", self.property_list.loading) self.source_replacer.replace("//release_properties", self.property_list.release) self.source_replacer.flush end |
#usage ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/ios_generate_settings.rb', line 38 def usage puts "Usage:" puts "\tios_generate_settings name:type" puts "Example:" puts "\tios_generate_settings name:NSString count:NSNumber" exit 1 end |