Sha256: 848ae69175ca92407e41d67cfc97a342ca7195505b3fe143631f03f001d6c53b

Contents?: true

Size: 725 Bytes

Versions: 44

Compression:

Stored size: 725 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.strategy.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, *)
      public_instance_methods.include?(m)
    end
  end # class << self
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
agilibox-1.7.4 app/sms/agilibox/sms/application_sms.rb
agilibox-1.7.3 app/sms/agilibox/sms/application_sms.rb
agilibox-1.7.2 app/sms/agilibox/sms/application_sms.rb
agilibox-1.7.1 app/sms/agilibox/sms/application_sms.rb
agilibox-1.7.0 app/sms/agilibox/sms/application_sms.rb
agilibox-1.6.2 app/sms/agilibox/sms/application_sms.rb
agilibox-1.6.1 app/sms/agilibox/sms/application_sms.rb
agilibox-1.6.0 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.13 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.12 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.11 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.10 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.9 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.8 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.7 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.6 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.5 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.4 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.3 app/sms/agilibox/sms/application_sms.rb
agilibox-1.5.2 app/sms/agilibox/sms/application_sms.rb