Sha256: c30a77f3d8894e48deedf45219f8c211c0a5db73dd36fd8f4010cadaabfa12eb

Contents?: true

Size: 667 Bytes

Versions: 21

Compression:

Stored size: 667 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.new
      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

21 entries across 21 versions & 1 rubygems

Version Path
smshelper-0.4.12 lib/smshelper/message.rb
smshelper-0.4.11 lib/smshelper/message.rb
smshelper-0.4.10 lib/smshelper/message.rb
smshelper-0.4.9 lib/smshelper/message.rb
smshelper-0.4.8 lib/smshelper/message.rb
smshelper-0.4.7 lib/smshelper/message.rb
smshelper-0.4.6 lib/smshelper/message.rb
smshelper-0.4.5 lib/smshelper/message.rb
smshelper-0.4.0 lib/smshelper/message.rb
smshelper-0.3.1 lib/smshelper/message.rb
smshelper-0.3.0 lib/smshelper/message.rb
smshelper-0.2.10 lib/smshelper/message.rb
smshelper-0.2.9 lib/smshelper/message.rb
smshelper-0.2.8 lib/smshelper/message.rb
smshelper-0.2.7 lib/smshelper/message.rb
smshelper-0.2.6 lib/smshelper/message.rb
smshelper-0.2.5 lib/smshelper/message.rb
smshelper-0.2.4 lib/smshelper/message.rb
smshelper-0.2.3 lib/smshelper/message.rb
smshelper-0.2.2 lib/smshelper/message.rb