Commit 435186b

mo khan <mo@mokhan.ca>
2013-03-31 18:29:08
move textbox builder to a separate file
1 parent 8d923b3
Changed files (3)
app/controllers/controls/build.rb
@@ -0,0 +1,5 @@
+class Build
+  def self.text_field(coordinates)
+    TextBoxBuilder.new(coordinates)
+  end
+end
app/controllers/controls/text_box_builder.rb
@@ -0,0 +1,15 @@
+class TextBoxBuilder
+  def initialize(coordinates)
+    @text_field = UITextField.alloc.initWithFrame(coordinates)
+    @text_field.autocapitalizationType = UITextAutocapitalizationTypeNone
+    @text_field.borderStyle = UITextBorderStyleRoundedRect
+  end
+  def centered_within(view)
+    @text_field.textAlignment = UITextAlignmentCenter
+    @text_field.center = CGPointMake(view.frame.size.width / 2, view.frame.size.height / 2 - 100)
+    self
+  end
+  def build
+    @text_field
+  end
+end
app/controllers/restaurant_controller.rb
@@ -33,25 +33,3 @@ class RestaurantController < UIViewController
     self.view.addSubview(view)
   end
 end
-
-class Build
-  def self.text_field(coordinates)
-    TextBoxBuilder.new(coordinates)
-  end
-end
-
-class TextBoxBuilder
-  def initialize(coordinates)
-    @text_field = UITextField.alloc.initWithFrame(coordinates)
-    @text_field.autocapitalizationType = UITextAutocapitalizationTypeNone
-    @text_field.borderStyle = UITextBorderStyleRoundedRect
-  end
-  def centered_within(view)
-    @text_field.textAlignment = UITextAlignmentCenter
-    @text_field.center = CGPointMake(view.frame.size.width / 2, view.frame.size.height / 2 - 100)
-    self
-  end
-  def build
-    @text_field
-  end
-end