Sha256: abbd594355c0fe8b2a9d85eac83a06ef199cc1ecd3a614dc1bd9425a9734c0a5

Contents?: true

Size: 736 Bytes

Versions: 14

Compression:

Stored size: 736 Bytes

Contents

class Agilibox::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)
    Agilibox::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

14 entries across 14 versions & 1 rubygems

Version Path
agilibox-1.11.0 app/sms/agilibox/sms/application_sms.rb
agilibox-1.10.5 app/sms/agilibox/sms/application_sms.rb
agilibox-1.10.2 app/sms/agilibox/sms/application_sms.rb
agilibox-1.10.1 app/sms/agilibox/sms/application_sms.rb
agilibox-1.10.0 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.20 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.19 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.18 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.17 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.16 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.15 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.14 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.13 app/sms/agilibox/sms/application_sms.rb
agilibox-1.9.12 app/sms/agilibox/sms/application_sms.rb