Sha256: c494d111ffa0948146546f389283eae97f39d9481c1af873415623c5948bd4df
Contents?: true
Size: 775 Bytes
Versions: 13
Compression:
Stored size: 775 Bytes
Contents
class String include ReactiveTags alias :__old_plus :+ if RUBY_PLATFORM != 'opal' alias :__old_concat :<< end # alias :concat :__old_concat # In volt, we want a value + reactive strings to return a reactive string. So we # over-ride + to check for when we are adding a reactive string to a string. def +(val) result = __old_plus(val.cur) if val.reactive? && !result.reactive? result = ReactiveValue.new(result) end return result end if RUBY_PLATFORM != 'opal' tag_method(:<<) do destructive! end def <<(val) if val.reactive? raise "Cannot append a reactive string to non-reactive string. Use + instead" end result = __old_concat(val) return result end end end
Version data entries
13 entries across 13 versions & 1 rubygems