Sha256: 434200acf40ccf2a3b9ade9895a2260357c679a89e17779f7ec82cf11d5bf98f
Contents?: true
Size: 672 Bytes
Versions: 1
Compression:
Stored size: 672 Bytes
Contents
module Smshelper class Message attr_accessor :recipient, :text, :sender attr_reader :utf_8 def initialize(attributes = {}) @recipient = attributes[:recipient] @text = attributes[:text] @sender = attributes[:sender] is_gsm(@text) ? (@utf_8 = false) : (@utf_8 = true) end def is_gsm(text) dl = Smshelper::Languagetools::Charset.instance lang = dl.is_gsm(text) end # def to_hex # @text = @text.unpack('U*').collect {|x| sprintf '%02X', x}.join # end # convert text to UCS-2 BigEndian def to_hex_be @text = @text.unpack('U*').collect {|x| sprintf '%04X', x}.join end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smshelper-0.2.0 | lib/smshelper/message.rb |