Sha256: 59597bdb8fad21126b42d2773412ad3bdfc57efb88326e3950877348db030d31
Contents?: true
Size: 985 Bytes
Versions: 3
Compression:
Stored size: 985 Bytes
Contents
module RedmineCLI module Helpers # # Helpers for output # module Output # # for Helpers::Input # def print_prompt_message(text, params = {}) print text print "[#{params[:default]}] " if params.key? :default print "(#{params[:limited_to].join(', ')}) " if params[:limited_to].is_a? Array end # # Alias for TemplateRenderer#render # def erb(template, vars = {}) RedmineCLI::TemplateRenderer.render(template, vars) end # # Gets text from I18n and replaces params # e.g. # I18n.t(:hello) => 'Hello, {{ user }}' # message(:hello, user: 'Vasya') => 'Hello, Vasya' # # @param name [Symbol] # @param params [Hash] optional # def message(name, params = {}) result = I18n.t name params.each { |k, e| result.gsub!("{{ #{k} }}", e.to_s) } result end alias m message end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redmine_cli-0.2.2 | lib/redmine_cli/helpers/output.rb |
redmine_cli-0.2.1 | lib/redmine_cli/helpers/output.rb |
redmine_cli-0.2.0 | lib/redmine_cli/helpers/output.rb |