Class: IosLocalizer::HelperMethods

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

Instance Method Summary collapse

Instance Method Details

#directory_exists?(directory) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/ios_localizer.rb', line 27

def directory_exists?(directory)
	File.directory?(directory)
end

#extract_word(line) ⇒ Object



31
32
33
# File 'lib/ios_localizer.rb', line 31

def extract_word(line)
	$regex.match(line)[1]
end

#getDataFromURL(url) ⇒ Object

Helper functions



18
19
20
21
22
23
24
25
# File 'lib/ios_localizer.rb', line 18

def getDataFromURL(url)
	uri = URI.parse(url.strip)
	http = Net::HTTP.new(uri.host,uri.port)
	http.use_ssl = true
	http.verify_mode = OpenSSL::SSL::VERIFY_NONE
	lr = http.request(Net::HTTP::Get.new(uri.request_uri))
	JSON.parse (lr.body)
end

#should_line_be_translated(line) ⇒ Object



35
36
37
# File 'lib/ios_localizer.rb', line 35

def should_line_be_translated (line)
	$regex.match(line) != nil
end