Sha256: c78b1da1ff63a19416d08a20a5d6ed2b28a148e1d8a91ccdf5491e8c3841e667
Contents?: true
Size: 721 Bytes
Versions: 21
Compression:
Stored size: 721 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' 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
21 entries across 21 versions & 1 rubygems