Class: Please::Context
- Inherits:
-
Object
- Object
- Please::Context
- Defined in:
- lib/please/context.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Context
constructor
A new instance of Context.
- #to_s ⇒ Object
Constructor Details
#initialize(options) ⇒ Context
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/please/context.rb', line 57 def initialize() @examples = [] @examples += DEFAULT_EXAMPLES unless [:skip_default_examples] @examples << OPTIONAL_EXAMPLES[:pwd] if [:send_pwd] @examples << OPTIONAL_EXAMPLES[:uname] if [:send_uname] @examples << OPTIONAL_EXAMPLES[:ls] if [:send_ls] @examples += [:examples] end |
Instance Method Details
#to_s ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/please/context.rb', line 69 def to_s @examples.map do |example| <<~EXAMPLE.chomp # #{example[:instruction]} $ #{example[:command]} #{example[:execute] ? `#{example[:command]}` : ""} EXAMPLE end.join("\n") end |