Class: Locraft::IOSConfig

Inherits:
Config
  • Object
show all
Defined in:
lib/locraft/model/config.rb

Instance Attribute Summary collapse

Attributes inherited from Config

#default_lang, #from_file, #gdoc_comments_column, #gdoc_file, #gdoc_keys_column, #gdoc_sheet, #langs, #platform, #strings_basename, #strings_destination

Instance Method Summary collapse

Methods inherited from Config

#from_folder, load_from, #relative_strings_destination

Constructor Details

#initialize {|_self| ... } ⇒ IOSConfig

Returns a new instance of IOSConfig.

Yields:

  • (_self)

Yield Parameters:



80
81
82
83
84
85
86
87
88
# File 'lib/locraft/model/config.rb', line 80

def initialize
  super()
  self.platform = IOS
  self.dev_lang = OBJC
  self.dev_prefix = 'XYZ'
  self.macro_file = 'LocalizedConstants'
  self.info_plist_basename = 'InfoPlist'
  yield self if block_given?
end

Instance Attribute Details

#dev_langObject

Returns the value of attribute dev_lang.



75
76
77
# File 'lib/locraft/model/config.rb', line 75

def dev_lang
  @dev_lang
end

#dev_prefixObject

Returns the value of attribute dev_prefix.



76
77
78
# File 'lib/locraft/model/config.rb', line 76

def dev_prefix
  @dev_prefix
end

#info_plist_basenameObject

Returns the value of attribute info_plist_basename.



73
74
75
# File 'lib/locraft/model/config.rb', line 73

def info_plist_basename
  @info_plist_basename
end

#info_plist_destinationObject

Returns the value of attribute info_plist_destination.



72
73
74
# File 'lib/locraft/model/config.rb', line 72

def info_plist_destination
  @info_plist_destination
end

#keys_mapObject

Returns the value of attribute keys_map.



77
78
79
# File 'lib/locraft/model/config.rb', line 77

def keys_map
  @keys_map
end

#macro_destinationObject

Returns the value of attribute macro_destination.



74
75
76
# File 'lib/locraft/model/config.rb', line 74

def macro_destination
  @macro_destination
end

#macro_fileObject

Returns the value of attribute macro_file.



78
79
80
# File 'lib/locraft/model/config.rb', line 78

def macro_file
  @macro_file
end

Instance Method Details

#constants_generatorObject



116
117
118
119
120
121
122
# File 'lib/locraft/model/config.rb', line 116

def constants_generator
  if dev_lang == SWIFT
    SwiftConstantsGenerator.new(self)
  elsif dev_lang == OBJC
    ObjcConstantsGenerator.new(self)
  end
end

#info_plist_fileObject



104
105
106
# File 'lib/locraft/model/config.rb', line 104

def info_plist_file
  "#{info_plist_basename}#{STRINGS_EXT}"
end

#info_plist_generatorObject



112
113
114
# File 'lib/locraft/model/config.rb', line 112

def info_plist_generator
  InfoPlistGenerator.new(self)
end

#relative_macro_destinationObject



95
96
97
98
# File 'lib/locraft/model/config.rb', line 95

def relative_macro_destination
  return nil if macro_destination.nil?
  File.expand_path('../' + macro_destination, from_file)
end

#relative_plist_destinationObject



90
91
92
93
# File 'lib/locraft/model/config.rb', line 90

def relative_plist_destination
  return nil if info_plist_destination.nil?
  File.expand_path('../' + info_plist_destination, from_file)
end

#strings_fileObject



100
101
102
# File 'lib/locraft/model/config.rb', line 100

def strings_file
  "#{strings_basename}#{STRINGS_EXT}"
end

#strings_generatorsObject



108
109
110
# File 'lib/locraft/model/config.rb', line 108

def strings_generators
  [StringsGenerator.new(self), info_plist_generator, constants_generator].select(&:valid?)
end