From ef50adddf3dc7207ae23d8fefdc206591eb47a85 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20W=20Mittag?= Date: Thu, 26 Mar 2009 14:57:03 +0100 Subject: [PATCH] Conform to my unwritten, undocumented style rules. --- Rakefile.rb | 2 +- features/akkordarbeit.feature | 64 +++++++++++++++++++------------------- lib/akkordarbeit/parser.rb | 2 +- lib/akkordarbeit/text_formatter.rb | 10 ++---- tasks/features_task.rb | 4 +-- 5 files changed, 39 insertions(+), 43 deletions(-) diff --git a/Rakefile.rb b/Rakefile.rb index 535e589..a77aa22 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -9,4 +9,4 @@ require 'rake' taskdir = File.expand_path File.join(File.dirname(__FILE__), 'tasks') $LOAD_PATH.unshift taskdir unless $LOAD_PATH.include? taskdir -FileList[File.join taskdir, '**', '*_task.rb'].each { |raketask| load raketask } +FileList[File.join taskdir, '**', '*_task.rb'].each do |task| load task end diff --git a/features/akkordarbeit.feature b/features/akkordarbeit.feature index 6fa8c96..97c5220 100644 --- a/features/akkordarbeit.feature +++ b/features/akkordarbeit.feature @@ -2,7 +2,7 @@ Feature: Parsing In order to seperate backend and frontend As a backend writer I want to get a parsetree - + Scenario: Simple Song Given the song """ @@ -14,7 +14,7 @@ Feature: Parsing """ [ [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"] + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'] ] ] """ @@ -31,8 +31,8 @@ Feature: Parsing """ [ [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"], - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"] + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'], + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'] ] ] """ @@ -51,14 +51,14 @@ Feature: Parsing Then the parsetree should be """ [ - [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"], - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"] - ], - [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"], - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"] - ] + [ + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'], + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'] + ], + [ + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'], + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'] + ] ] """ @@ -72,9 +72,9 @@ Feature: Text Output Given the parsetree """ [ - [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"] - ] + [ + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'] + ] ] """ @@ -83,18 +83,18 @@ Feature: Text Output """ [D] [Em] Do what I say, or I will suffer - - + + """ Scenario: Text Output of a simple Song with one Section and two lines Given the parsetree """ [ - [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"], - ["Do what ", "[D]", "I say, ", "[Em]", "or I will suffer"] - ] + [ + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'], + ['Do what ', '[D]', 'I say, ', '[Em]', 'or I will suffer'] + ] ] """ @@ -105,22 +105,22 @@ Feature: Text Output Do what I say, or I will suffer [D] [Em] Do what I say, or I will suffer - - + + """ Scenario: Text Output of a simple Song with two Section and two lines Given the parsetree """ [ - [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"], - ["Do what ", "[D]", "I say, ", "[Em]", "or I will suffer"] - ], - [ - ["[D]", "Do what I say, ", "[Em]", "or I will suffer"], - ["Do what ", "[D]", "I say, ", "[Em]", "or I will suffer"] - ] + [ + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'], + ['Do what ', '[D]', 'I say, ', '[Em]', 'or I will suffer'] + ], + [ + ['[D]', 'Do what I say, ', '[Em]', 'or I will suffer'], + ['Do what ', '[D]', 'I say, ', '[Em]', 'or I will suffer'] + ] ] """ @@ -131,7 +131,7 @@ Feature: Text Output Do what I say, or I will suffer [D] [Em] Do what I say, or I will suffer - + [D] [Em] Do what I say, or I will suffer [D] [Em] diff --git a/lib/akkordarbeit/parser.rb b/lib/akkordarbeit/parser.rb index 1d2618b..549719e 100644 --- a/lib/akkordarbeit/parser.rb +++ b/lib/akkordarbeit/parser.rb @@ -20,7 +20,7 @@ module Akkordarbeit end song << section end - song + return song end end end diff --git a/lib/akkordarbeit/text_formatter.rb b/lib/akkordarbeit/text_formatter.rb index 59a3b50..deb7c74 100644 --- a/lib/akkordarbeit/text_formatter.rb +++ b/lib/akkordarbeit/text_formatter.rb @@ -7,14 +7,12 @@ libdir = File.expand_path(File.dirname __FILE__).gsub(/(.*lib).*?/, '\1') $LOAD_PATH.unshift libdir unless $LOAD_PATH.include? libdir module Akkordarbeit - class TextFormatter - def format(parsetree) - output = "" + output = '' parsetree.each do |section| section.each do |line| - chords, lyrics = "", "" + chords, lyrics = '', '' line.each do |token| regex = /(\[.*?\])/ if regex.match(token) @@ -28,9 +26,7 @@ module Akkordarbeit end output << "\n" end - output + return output end - end - end diff --git a/tasks/features_task.rb b/tasks/features_task.rb index 6f66ce8..63a6e25 100644 --- a/tasks/features_task.rb +++ b/tasks/features_task.rb @@ -14,6 +14,6 @@ $LOAD_PATH.unshift featuredir unless $LOAD_PATH.include? featuredir basedir = File.expand_path File.join(featuredir, '..') $LOAD_PATH.unshift basedir unless $LOAD_PATH.include? basedir -Cucumber::Rake::Task.new(:features) do |t| - t.cucumber_opts = "--format pretty" +Cucumber::Rake::Task.new :features do |t| + t.cucumber_opts = '--format pretty' end -- 2.11.4.GIT