<commit_before>class	FlashlightViewController < UIViewController
	attr_accessor :torch

	def loadView
		self.view = UIImageView.alloc.init
	end

	def viewDidLoad
		view.image = UIImage.imageNamed( 'background.png' )
		view.userInteractionEnabled = true
		tap_recognizer = UITapGestureRecognizer.alloc.initWithTarget( self, action: 'toggle_torch' )
		view.addGestureRecognizer( tap_recognizer )
	end

	def toggle_torch
		# change background image
		@torch.toggle_torch
	end

end<commit_msg>allow to show different images depending on torch's state<commit_after>class	FlashlightViewController < UIViewController
	attr_accessor :torch

	BACKGORUND_IMAGES = { turned_on: 'background.png', turned_off: 'background.png', unavailable: 'background.png' }

	def loadView
		self.view = UIImageView.alloc.init
	end

	def viewDidLoad
		view.image = UIImage.imageNamed( BACKGORUND_IMAGES[ @torch.available? ? :turned_on : :unavailable ] )
		view.userInteractionEnabled = true
		tap_recognizer = UITapGestureRecognizer.alloc.initWithTarget( self, action: 'toggle_torch' )
		view.addGestureRecognizer( tap_recognizer )
	end

	def toggle_torch
		background_image = ''
		@torch.toggle_torch
	end

end
{'fraction_non_alphanumeric': 0.07945900253592561, 'fraction_numerical': 0.0, 'mean_word_length': 5.469945355191257, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5859459', 'n_tokens_mistral': 415, 'n_tokens_neox': 384, 'n_words': 81}