lib/eco/data/mapper.rb in eco-helpers-2.5.10 vs lib/eco/data/mapper.rb in eco-helpers-2.6.0
- old
+ new
@@ -60,18 +60,23 @@
def include?(value)
return true if !@source
internal?(value) || external?(value)
end
+ # Whether `value` maps to itself
+ def self_mapped?(value)
+ return false unless include?(value)
+ value == to_internal(value)
+ end
+
def to_internal(value)
return value if !@source
@by_external[value]
end
def to_external(value)
return value if !@source
@by_internal[value]
end
-
end
end
end