Sha256: 7bf9e6bff0f0e32263d66590464ab310ec92b74cb81c92329c55c4b0fd870868

Contents?: true

Size: 744 Bytes

Versions: 8

Compression:

Stored size: 744 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, ...)
      if respond_to_missing?(m)
        new(action_name: m).public_send(m, ...)
      else
        super
      end
    end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bmc-1.6.1 app/sms/bmc/sms/application_sms.rb
bmc-1.6.0 app/sms/bmc/sms/application_sms.rb
bmc-1.5.1 app/sms/bmc/sms/application_sms.rb
bmc-1.5.0 app/sms/bmc/sms/application_sms.rb
bmc-1.4.3 app/sms/bmc/sms/application_sms.rb
bmc-1.4.2 app/sms/bmc/sms/application_sms.rb
bmc-1.4.1 app/sms/bmc/sms/application_sms.rb
bmc-1.4.0 app/sms/bmc/sms/application_sms.rb