cwyckoff-babel_icious 0.0.5.0 → 0.0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,11 @@ module Babelicious
11
11
  def [](index)
12
12
  @parsed_path[index]
13
13
  end
14
-
14
+
15
+ def append(element)
16
+ "#{element}/#{@full_path}"
17
+ end
18
+
15
19
  def each(&block)
16
20
  @parsed_path.each(&block)
17
21
  end
@@ -37,11 +41,6 @@ module Babelicious
37
41
  untranslated_path.gsub(/^\//, "").split("/")
38
42
  end
39
43
 
40
- def unshift(element)
41
- @parsed_path.unshift(element)
42
- @full_path = "#{element}/" << @full_path
43
- end
44
-
45
44
  end
46
45
 
47
46
  end
@@ -54,9 +54,11 @@ module Babelicious
54
54
  raise TargetMapperError, "A mapping definition key is required (e.g., m.include(:another_map))" if map_definition.nil?
55
55
  raise TargetMapperError, "Mapping definition for #{map_definition} does not exist" unless (other_mapper = Mapper[map_definition.to_sym])
56
56
 
57
- other_mapper.mappings.each do |m|
58
- m[1].path_translator.unshift(opts[:inside_of]) if opts[:inside_of]
59
- @mappings << m
57
+ other_mapper.mappings.each do |m|
58
+ source = MapFactory.source(@direction, m[0].opts)
59
+ target = MapFactory.target(@direction, m[1].opts.merge(:to => to_path(m, opts)))
60
+
61
+ @mappings << [source, target]
60
62
  end
61
63
  end
62
64
 
@@ -82,6 +84,14 @@ module Babelicious
82
84
  target_element.map_from(target, source_value)
83
85
  end
84
86
  end
87
+
88
+ def to_path(mappings, opts)
89
+ if opts[:inside_of]
90
+ to_path = mappings[1].path_translator.append(opts[:inside_of])
91
+ else
92
+ to_path = mappings[1].path_translator.full_path
93
+ end
94
+ end
85
95
  end
86
96
  end
87
97
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cwyckoff-babel_icious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.0
4
+ version: 0.0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wyckoff
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-17 00:00:00 -07:00
12
+ date: 2009-06-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency