Class: Floom::Configuration
- Inherits:
-
Object
- Object
- Floom::Configuration
- Defined in:
- lib/floom/models/configuration.rb
Class Method Summary collapse
Instance Method Summary collapse
- #flow(val = nil) ⇒ Object
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #sink(val = nil) ⇒ Object
- #sink_version(val = nil) ⇒ Object
- #source(val = nil) ⇒ Object
- #source_version(val = nil) ⇒ Object
- #timestamp(val = nil) ⇒ Object
- #to_hash ⇒ Object
- #to_params ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 30 |
# File 'lib/floom/models/configuration.rb', line 23 def initialize( = {}) @source = [:source] @sink = [:sink] @flow = [:flow] @source_version = [:source_version] @sink_version = [:sink_version] @timestamp = [:timestamp] end |
Class Method Details
.create(options = {}, &blk) ⇒ Object
15 16 17 18 19 |
# File 'lib/floom/models/configuration.rb', line 15 def create( = {}, &blk) config = new() config.instance_eval(&blk) if block_given? config end |
.parse(conf) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/floom/models/configuration.rb', line 6 def parse(conf) new(source: conf.sourceConfig, sink: conf.sinkConfig, flow: conf.flowID, source_version: conf.sourceVersion, sink_version: conf.sinkVersion, timestamp: conf.).to_hash end |
Instance Method Details
#flow(val = nil) ⇒ Object
47 48 49 50 |
# File 'lib/floom/models/configuration.rb', line 47 def flow(val = nil) @flow = val if val @flow end |
#sink(val = nil) ⇒ Object
42 43 44 45 |
# File 'lib/floom/models/configuration.rb', line 42 def sink(val = nil) @sink = val if val @sink end |
#sink_version(val = nil) ⇒ Object
57 58 59 60 |
# File 'lib/floom/models/configuration.rb', line 57 def sink_version(val = nil) @sink_version = val if val @sink_version end |
#source(val = nil) ⇒ Object
37 38 39 40 |
# File 'lib/floom/models/configuration.rb', line 37 def source(val = nil) @source = val if val @source end |
#source_version(val = nil) ⇒ Object
52 53 54 55 |
# File 'lib/floom/models/configuration.rb', line 52 def source_version(val = nil) @source_version = val if val @source_version end |
#timestamp(val = nil) ⇒ Object
32 33 34 35 |
# File 'lib/floom/models/configuration.rb', line 32 def (val = nil) @timestamp = val if val @timestamp end |
#to_hash ⇒ Object
62 63 64 |
# File 'lib/floom/models/configuration.rb', line 62 def to_hash self.instance_variables.map{ |var| var.to_s.slice(1..-1).to_sym }.inject({}){ |hsh, var| hsh[var] = self.send(var) ; hsh } end |
#to_params ⇒ Object
66 67 68 |
# File 'lib/floom/models/configuration.rb', line 66 def to_params [ flow, source, sink ].compact end |