class Smshelper::Message

Attributes

recipient[RW]
sender[RW]
text[RW]
utf_8[R]

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/smshelper/message.rb, line 6
def initialize(attributes = {})
  @recipient = attributes[:recipient]
  @text = attributes[:text]
  @sender = attributes[:sender]
  is_gsm(@text) ? (@utf_8 = false) : (@utf_8 = true)
end

Public Instance Methods

is_gsm(text) click to toggle source
# File lib/smshelper/message.rb, line 13
def is_gsm(text)
  dl = Smshelper::Languagetools::Charset.new
  lang = dl.is_gsm(text)
end
to_hex_be() click to toggle source

convert text to UCS-2 BigEndian

# File lib/smshelper/message.rb, line 23
def to_hex_be
  @text = @text.unpack('U*').collect {|x| sprintf '%04X', x}.join
end