Class: Mushy::Pwd
Instance Attribute Summary
Attributes inherited from Flux
#config, #flow, #id, #masher, #parent_fluxs, #subscribed_to, #type
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Flux
#convert_this_to_an_array, #convert_to_symbolized_hash, #execute, #execute_single_event, #group_these_results, #guard, #ignore_these_results, inherited, #initialize, #join_these_results, #limit_these_results, #merge_these_results, #model_these_results, #outgoing_split_these_results, #shape_these, #sort_these_results, #standardize_these
Constructor Details
This class inherits a constructor from Mushy::Flux
Class Method Details
.details ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mushy/fluxs/pwd.rb', line 5 def self.details { name: 'Pwd', title: 'Get the working directory', description: 'Run the "pwd" command.', fluxGroup: { name: 'Environment' }, config: Mushy::Bash.details[:config].tap { |c| c.delete :command }, }.tap do |c| c[:examples] = { "Example" => { description: 'This will run the pwd command and return the directory information.', result: { pwd: { inode: "403091", hard_links: 5, owner: "pi", group: "pi", size: 4095, date: { year: 2020, month: 9, day: 5, hour: 10, minute: 43, second: 36, nanosecond: 325720074, utc_offset: -18001, weekday: 2, day_of_month: 5, day_of_year: 278, string: "2020-10-06 11:44:37 -0500", epoch_integer: 1633538676, epoch_float: 1633538676.32572, seconds_ago: 17558.38995246 }, name: "mushy", type: "d", owner_permission: "rwx", group_permission: "r-x", other_permission: "r-x", directory: "/home/pi/Desktop", path: "/home/pi/Desktop/mushy" } } } } end end |
Instance Method Details
#process(event, config) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/mushy/fluxs/pwd.rb', line 54 def process event, config config[:command] = 'pwd' result = super event, config return result unless result[:success] pwd = result[:text].to_s.strip { pwd: Mushy::Ls.new.process({}, { path: pwd, directory_only: true })[0] } end |