class Pantograph::Actions::SayAction

Public Class Methods

author() click to toggle source
# File pantograph/lib/pantograph/actions/say.rb, line 41
def self.author
  "KrauseFx"
end
available_options() click to toggle source
# File pantograph/lib/pantograph/actions/say.rb, line 21
def self.available_options
  [
    PantographCore::ConfigItem.new(key: :text,
                                 description: 'Text to be spoken out loud (as string or array of strings)',
                                 optional: false,
                                 is_string: false),
    PantographCore::ConfigItem.new(key: :mute,
                                 env_name: "SAY_MUTE",
                                 description: 'If say should be muted with text printed out',
                                 optional: false,
                                 is_string: false,
                                 type: Boolean,
                                 default_value: false)
  ]
end
category() click to toggle source
# File pantograph/lib/pantograph/actions/say.rb, line 51
def self.category
  :misc
end
description() click to toggle source
# File pantograph/lib/pantograph/actions/say.rb, line 17
def self.description
  "This action speaks the given text out loud"
end
example_code() click to toggle source
# File pantograph/lib/pantograph/actions/say.rb, line 45
def self.example_code
  [
    'say("I can speak")'
  ]
end
is_supported?(platform) click to toggle source
# File pantograph/lib/pantograph/actions/say.rb, line 37
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File pantograph/lib/pantograph/actions/say.rb, line 4
def self.run(params)
  text = params[:text]
  text = text.join(' ') if text.kind_of?(Array)
  text = text.tr("'", '"')

  if params[:mute]
    UI.message(text)
    return text
  else
    Actions.sh("say '#{text}'")
  end
end