Permalink
Browse files

Prepare to move munge into aggregate.

  • Loading branch information...
kytrinyx committed May 5, 2012
1 parent a843322 commit a24560d936d7b1c81e144e64d17466766e1974a9
Showing with 23 additions and 2 deletions.
  1. +5 −2 lib/langulator/aggregate.rb
  2. +18 −0 spec/aggregate_spec.rb
@@ -8,10 +8,13 @@ def from_file(filename, options)
end
end
- attr_reader :aggregate, :languages
+ attr_reader :aggregate, :languages, :source_language, :target_languages
def initialize(options = {})
@aggregate = options[:aggregate_translations]
- @languages = options[:languages]
+ @individual_translations = options[:individual_translations]
+ @source_language = options[:source_language]
+ @target_languages = Array(options[:target_languages])
+ @languages = options[:languages] || [source_language] + target_languages
end
def individual_translations
View
@@ -3,6 +3,24 @@
describe Langulator::Aggregate do
+ describe "combining individual translations" do
+ let(:compile_options) do
+ {
+ :source_language => :klingon,
+ :target_languages => :lolcode,
+ :individual_translations => {:klingon => klingon, :lolcode => lolcode}
+ }
+ end
+
+ subject { Langulator::Aggregate.new(compile_options) }
+
+ its(:source_language) { should eq(:klingon) }
+ its(:target_languages) { should eq([:lolcode]) }
+ its(:languages) { should eq([:klingon, :lolcode]) }
+ its(:individual_translations) { should eq({:klingon => klingon, :lolcode => lolcode}) }
+ xit(:aggregate) { should eq(aggregate) }
+ end
+
describe "de-aggregating translations" do
subject { Langulator::Aggregate.new(:languages => [:english]) }

0 comments on commit a24560d

Please sign in to comment.