Class: Mappum::FieldMap
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#dict ⇒ Object
Returns the value of attribute dict.
-
#from ⇒ Object
Returns the value of attribute from.
-
#func ⇒ Object
Returns the value of attribute func.
-
#func_on_nil ⇒ Object
Returns the value of attribute func_on_nil.
-
#l2r_name ⇒ Object
Returns the value of attribute l2r_name.
-
#left ⇒ Object
Returns the value of attribute left.
-
#map_when ⇒ Object
Returns the value of attribute map_when.
-
#name ⇒ Object
Returns the value of attribute name.
-
#name_prefix ⇒ Object
Returns the value of attribute name_prefix.
-
#r2l_name ⇒ Object
Returns the value of attribute r2l_name.
-
#right ⇒ Object
Returns the value of attribute right.
-
#submap_alias ⇒ Object
Returns the value of attribute submap_alias.
-
#to ⇒ Object
Returns the value of attribute to.
-
#to_array_take ⇒ Object
Returns the value of attribute to_array_take.
-
#to_array_take_l2r ⇒ Object
Returns the value of attribute to_array_take_l2r.
-
#to_array_take_r2l ⇒ Object
Returns the value of attribute to_array_take_r2l.
-
#when_l2r ⇒ Object
Returns the value of attribute when_l2r.
-
#when_r2l ⇒ Object
Returns the value of attribute when_r2l.
Attributes inherited from Map
#bidi_maps, #maps, #source, #src_ref, #strip_empty
Instance Method Summary collapse
- #func_on_nil? ⇒ Boolean
- #normalize ⇒ Object
-
#normalized? ⇒ Boolean
True if map is unidirectional.
- #simple? ⇒ Boolean
Methods inherited from Map
Constructor Details
This class inherits a constructor from Mappum::Map
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def block @block end |
#desc ⇒ Object
Returns the value of attribute desc.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def desc @desc end |
#dict ⇒ Object
Returns the value of attribute dict.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def dict @dict end |
#from ⇒ Object
Returns the value of attribute from.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def from @from end |
#func ⇒ Object
Returns the value of attribute func.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def func @func end |
#func_on_nil ⇒ Object
Returns the value of attribute func_on_nil.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def func_on_nil @func_on_nil end |
#l2r_name ⇒ Object
Returns the value of attribute l2r_name.
96 97 98 |
# File 'lib/mappum/map.rb', line 96 def l2r_name @l2r_name end |
#left ⇒ Object
Returns the value of attribute left.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def left @left end |
#map_when ⇒ Object
Returns the value of attribute map_when.
96 97 98 |
# File 'lib/mappum/map.rb', line 96 def map_when @map_when end |
#name ⇒ Object
Returns the value of attribute name.
96 97 98 |
# File 'lib/mappum/map.rb', line 96 def name @name end |
#name_prefix ⇒ Object
Returns the value of attribute name_prefix.
96 97 98 |
# File 'lib/mappum/map.rb', line 96 def name_prefix @name_prefix end |
#r2l_name ⇒ Object
Returns the value of attribute r2l_name.
96 97 98 |
# File 'lib/mappum/map.rb', line 96 def r2l_name @r2l_name end |
#right ⇒ Object
Returns the value of attribute right.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def right @right end |
#submap_alias ⇒ Object
Returns the value of attribute submap_alias.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def submap_alias @submap_alias end |
#to ⇒ Object
Returns the value of attribute to.
95 96 97 |
# File 'lib/mappum/map.rb', line 95 def to @to end |
#to_array_take ⇒ Object
Returns the value of attribute to_array_take.
97 98 99 |
# File 'lib/mappum/map.rb', line 97 def to_array_take @to_array_take end |
#to_array_take_l2r ⇒ Object
Returns the value of attribute to_array_take_l2r.
97 98 99 |
# File 'lib/mappum/map.rb', line 97 def to_array_take_l2r @to_array_take_l2r end |
#to_array_take_r2l ⇒ Object
Returns the value of attribute to_array_take_r2l.
97 98 99 |
# File 'lib/mappum/map.rb', line 97 def to_array_take_r2l @to_array_take_r2l end |
#when_l2r ⇒ Object
Returns the value of attribute when_l2r.
96 97 98 |
# File 'lib/mappum/map.rb', line 96 def when_l2r @when_l2r end |
#when_r2l ⇒ Object
Returns the value of attribute when_r2l.
96 97 98 |
# File 'lib/mappum/map.rb', line 96 def when_r2l @when_r2l end |
Instance Method Details
#func_on_nil? ⇒ Boolean
154 155 156 |
# File 'lib/mappum/map.rb', line 154 def func_on_nil? @func_on_nil end |
#normalize ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/mappum/map.rb', line 112 def normalize #if bidirectional if not normalized? map_r2l = self.clone map_r2l.to = self.left map_r2l.from = self.right map_r2l.name = self.r2l_name map_r2l.r2l_name, map_r2l.l2r_name = nil, nil map_r2l.map_when = self.when_r2l map_r2l.when_r2l, map_r2l.when_l2r = nil, nil map_r2l.to_array_take = self.to_array_take_r2l map_r2l.to_array_take_r2l, map_r2l.to_array_take_l2r = nil, nil map_r2l.dict = self.dict.invert unless self.dict.nil? map_l2r = self.clone map_l2r.to = self.right map_l2r.from = self.left map_l2r.name = self.l2r_name map_l2r.r2l_name, map_l2r.l2r_name = nil, nil map_l2r.map_when = self.when_l2r map_l2r.when_r2l, map_l2r.when_l2r = nil, nil map_l2r.to_array_take = self.to_array_take_l2r map_l2r.to_array_take_r2l, map_l2r.to_array_take_l2r = nil, nil map_r2l.maps = self.maps.select do |m| m.to.parent == map_r2l.to or m.to.parent.kind_of? Context end map_l2r.maps = self.maps.select do |m| m.to.parent == map_l2r.to or m.to.parent.kind_of? Context end [map_r2l, map_l2r] else [self] end end |
#normalized? ⇒ Boolean
True if map is unidirectional. Map is unidirectional when maps one way only.
100 101 102 |
# File 'lib/mappum/map.rb', line 100 def normalized? not @from.nil? end |
#simple? ⇒ Boolean
150 151 152 153 |
# File 'lib/mappum/map.rb', line 150 def simple? @func.nil? && @dict.nil? && @desc.nil? && @maps.empty? && @bidi_maps.empty? && @right.func.nil? && @left.func.nil? end |