Class: Mushy::Format

Inherits:
Flux
  • Object
show all
Defined in:
lib/mushy/fluxs/format.rb

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

.detailsObject



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/format.rb', line 5

def self.details
  {
    name: 'Format',
    title: 'Alter the format of an event',
    description: 'Return the event passed to it. This opens the opportunity to use the common fluxing to alter the event.',
    fluxGroup: { name: 'Flows' },
    config: {},
    examples: {
      "Simplest Example" => {
                              description: 'It only returns what is passed to it.',
                              input: {
                                       hello: 'world',
                                     },
                              config: {
                                      },
                              result: {
                                        hello: 'world',
                                      }
                            },
      "Changing The Event" => {
                                description: 'The common fluxing can still be used to alter the event.',
                                input: {
                                         things: [
                                                   { name: "Elephant", type: "Mammal" },
                                                   { name: "Alligator", type: "Reptile" },
                                                   { name: "Giraffe", type: "Mammal" }
                                                 ]
                                       },
                                config: { outgoing_split:"things",group:"type|animal_type" },
                                result: [
                                          {
                                            animal_type: [
                                                          {
                                                            name: "Elephant",
                                                            type: "Mammal"
                                                          },
                                                          {
                                                            name: "Giraffe",
                                                            type: "Mammal"
                                                          }
                                                        ]
                                          },
                                          { animal_type:[ { name:"Alligator",type:"Reptile" } ] }
                                        ]
                            },
    }
  }
end

Instance Method Details

#process(event, config) ⇒ Object



54
55
56
# File 'lib/mushy/fluxs/format.rb', line 54

def process event, config
  event
end