Sha256: cc857379a726981bcf7e88234862c321575272c33f2b745e7972708d1304dfde

Contents?: true

Size: 726 Bytes

Versions: 11

Compression:

Stored size: 726 Bytes

Contents

class BMC::SMS::ApplicationSMS
  attr_reader :options

  def initialize(options)
    @options = options
  end

  private

  def action_name
    options[:action_name]
  end

  def t(key, **args)
    if key.start_with?(".")
      path = self.class.to_s.underscore.tr("/", ".")
      key  = "#{path}.#{action_name}#{key}"
    end

    I18n.t(key, **args)
  end

  def sms(data)
    BMC::SMS::Message.new(data)
  end

  class << self
    private :new

    def method_missing(m, *args)
      if respond_to_missing?(m)
        new(action_name: m).public_send(m, *args)
      else
        super
      end
    end

    def respond_to_missing?(m, *)
      super || public_instance_methods.include?(m)
    end
  end # class << self
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bmc-1.3.5 app/sms/bmc/sms/application_sms.rb
bmc-1.3.4 app/sms/bmc/sms/application_sms.rb
bmc-1.3.3 app/sms/bmc/sms/application_sms.rb
bmc-1.3.2 app/sms/bmc/sms/application_sms.rb
bmc-1.3.1 app/sms/bmc/sms/application_sms.rb
bmc-1.3.0 app/sms/bmc/sms/application_sms.rb
bmc-1.2.1 app/sms/bmc/sms/application_sms.rb
bmc-1.2.0 app/sms/bmc/sms/application_sms.rb
bmc-1.1.0 app/sms/bmc/sms/application_sms.rb
bmc-1.0.1 app/sms/bmc/sms/application_sms.rb
bmc-1.0.0 app/sms/bmc/sms/application_sms.rb