Skip to content
This repository
Browse code

code & spacing cleanup in ifancy

  • Loading branch information...
commit 60bb21777656791ad227c3f227a77d01cc0050c7 1 parent c5e1ec2
Christopher Bertels authored October 12, 2012

Showing 1 changed file with 21 additions and 12 deletions. Show diff stats Hide diff stats

  1. 33  bin/ifancy
33  bin/ifancy
@@ -27,18 +27,25 @@ try {
27 27
  "Fancy #{Fancy VERSION}"] println
28 28
 
29 29
 HISTORY_FILE = File expand_path("~/.fancy_history")
30  
-HISTORY = []
31  
-
32  
-PROMPT = "ifancy[%d]> "
  30
+HISTORY      = []
  31
+PROMPT       = "ifancy[%d]> "
33 32
 
34 33
 class Prompt {
35 34
   def initialize: @str {
36 35
     @line = 0
37 36
   }
38 37
 
39  
-  def inc_line { @line = @line + 1 }
40  
-  def aug_line: num { @line = @line + num }
41  
-  def to_s { sprintf(@str, @line) }
  38
+  def inc_line {
  39
+    @line = @line + 1
  40
+  }
  41
+
  42
+  def aug_line: num {
  43
+    @line = @line + num
  44
+  }
  45
+
  46
+  def to_s {
  47
+    sprintf(@str, @line)
  48
+  }
42 49
 }
43 50
 
44 51
 class Feature {
@@ -50,7 +57,9 @@ class Feature {
50 57
     @@hooks[@name]: self
51 58
   }
52 59
 
53  
-  def run: string { @block call: string }
  60
+  def run: string {
  61
+    @block call: string
  62
+  }
54 63
 
55 64
   def about: name_width (@name size) {
56 65
     sprintf("%-#{name_width}s : %s", @name, @desc)
@@ -76,7 +85,7 @@ class Feature {
76 85
 }
77 86
 
78 87
 ARGV rest each: |file| {
79  
-  "LOADING: " ++ file println
  88
+  "LOADING: #{file}" println
80 89
   require: file
81 90
 }
82 91
 
@@ -177,14 +186,14 @@ Feature new: "#{" will: "Create multiline capabilities" by: {
177 186
   line = read_line: "-> "
178 187
   line_s = ""
179 188
   until: { line =~ /^\#}$/ == 0} do: {
180  
-    line_s = line_s ++  line ++ "\n"
  189
+    line_s = line_s ++ line ++ "\n"
181 190
     line = read_line: "-> "
182 191
   }
183 192
   try {
184 193
     Fancy eval: line_s binding: bnd . inspect println
185  
-    prompt aug_line: (( line_s split: "\n") size)
  194
+    prompt aug_line: (line_s split: "\n" . size)
186 195
   } catch Exception => e {
187  
-    e message() println
  196
+    e message println
188 197
   }
189 198
 }
190 199
 
@@ -206,6 +215,6 @@ loop: {
206 215
     }
207 216
 	  prompt inc_line
208 217
   } catch Exception => e {
209  
-    e message() println
  218
+    e message println
210 219
   }
211 220
 }

0 notes on commit 60bb217

Please sign in to comment.
Something went wrong with that request. Please try again.