Sha256: 6f7a9b6df7efe386ad1b2e15385f04cfe2528481002bfa8ee2e2fffb998a18b7
Contents?: true
Size: 945 Bytes
Versions: 16
Compression:
Stored size: 945 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' require 'ehbrs_ruby_utils/executables' module EhbrsRubyUtils module Mudslide class Message acts_as_immutable immutable_accessor :image_path, :recipient, :text def deliver raise 'No recipient set' if recipient.blank? if image_path.present? deliver_image elsif text.present? deliver_text else deliver end end private # @return [void] def deliver_image args = ['send-image'] text.if_present { |_v| args += ['--caption', text] } mudslide_run(*args, recipient, image_path) end # @return [void] def deliver_text mudslide_run('send', recipient, text) end # @return [void] def mudslide_run(*args) ::EhbrsRubyUtils::Executables.mudslide.command(*args).system! end end end end
Version data entries
16 entries across 16 versions & 1 rubygems