Class: Opener::Daemons::Configuration
- Inherits:
-
Object
- Object
- Opener::Daemons::Configuration
- Defined in:
- lib/opener/daemons/configuration.rb
Overview
Configuration object for storing details about a single job.
Instance Attribute Summary collapse
- #callbacks ⇒ Array readonly
- #component ⇒ Class readonly
- #component_options ⇒ Hash readonly
-
#input ⇒ Object
readonly
Returns the value of attribute input.
- #input_url ⇒ String readonly
- #metadata ⇒ Hash readonly
Instance Method Summary collapse
-
#component_instance ⇒ Object
Returns a new instance of the component.
-
#identifier ⇒ String
Returns the identifier of the document.
-
#initialize(component, component_options = {}, options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(component, component_options = {}, options = {}) ⇒ Configuration
Returns a new instance of Configuration.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/opener/daemons/configuration.rb', line 39 def initialize(component, = {}, = {}) @component = component @component_options = .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end @callbacks ||= [] @metadata ||= {} end |
Instance Attribute Details
#callbacks ⇒ Array (readonly)
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/opener/daemons/configuration.rb', line 21 class Configuration attr_reader :component, :component_options attr_reader :input, :input_url attr_reader :callbacks, :metadata ## # @param [Class] component The component to use. # @param [Hash] component_options Options to pass to the component. # # @param [Hash] options # # @option options [String] :input_url # @option options [String] :identifier # @option options [Array] :callbacks # @option options [Hash] :metadata # def initialize(component, = {}, = {}) @component = component @component_options = .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end @callbacks ||= [] @metadata ||= {} end ## # Returns the identifier of the document. If no identifier was given a # unique one will be generated instead. # # @return [String] # def identifier return @identifier ||= SecureRandom.hex end ## # Returns a new instance of the component. # # @return [Object] # def component_instance return component.new() end end |
#component ⇒ Class (readonly)
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/opener/daemons/configuration.rb', line 21 class Configuration attr_reader :component, :component_options attr_reader :input, :input_url attr_reader :callbacks, :metadata ## # @param [Class] component The component to use. # @param [Hash] component_options Options to pass to the component. # # @param [Hash] options # # @option options [String] :input_url # @option options [String] :identifier # @option options [Array] :callbacks # @option options [Hash] :metadata # def initialize(component, = {}, = {}) @component = component @component_options = .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end @callbacks ||= [] @metadata ||= {} end ## # Returns the identifier of the document. If no identifier was given a # unique one will be generated instead. # # @return [String] # def identifier return @identifier ||= SecureRandom.hex end ## # Returns a new instance of the component. # # @return [Object] # def component_instance return component.new() end end |
#component_options ⇒ Hash (readonly)
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/opener/daemons/configuration.rb', line 21 class Configuration attr_reader :component, :component_options attr_reader :input, :input_url attr_reader :callbacks, :metadata ## # @param [Class] component The component to use. # @param [Hash] component_options Options to pass to the component. # # @param [Hash] options # # @option options [String] :input_url # @option options [String] :identifier # @option options [Array] :callbacks # @option options [Hash] :metadata # def initialize(component, = {}, = {}) @component = component @component_options = .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end @callbacks ||= [] @metadata ||= {} end ## # Returns the identifier of the document. If no identifier was given a # unique one will be generated instead. # # @return [String] # def identifier return @identifier ||= SecureRandom.hex end ## # Returns a new instance of the component. # # @return [Object] # def component_instance return component.new() end end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
25 26 27 |
# File 'lib/opener/daemons/configuration.rb', line 25 def input @input end |
#input_url ⇒ String (readonly)
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/opener/daemons/configuration.rb', line 21 class Configuration attr_reader :component, :component_options attr_reader :input, :input_url attr_reader :callbacks, :metadata ## # @param [Class] component The component to use. # @param [Hash] component_options Options to pass to the component. # # @param [Hash] options # # @option options [String] :input_url # @option options [String] :identifier # @option options [Array] :callbacks # @option options [Hash] :metadata # def initialize(component, = {}, = {}) @component = component @component_options = .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end @callbacks ||= [] @metadata ||= {} end ## # Returns the identifier of the document. If no identifier was given a # unique one will be generated instead. # # @return [String] # def identifier return @identifier ||= SecureRandom.hex end ## # Returns a new instance of the component. # # @return [Object] # def component_instance return component.new() end end |
#metadata ⇒ Hash (readonly)
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/opener/daemons/configuration.rb', line 21 class Configuration attr_reader :component, :component_options attr_reader :input, :input_url attr_reader :callbacks, :metadata ## # @param [Class] component The component to use. # @param [Hash] component_options Options to pass to the component. # # @param [Hash] options # # @option options [String] :input_url # @option options [String] :identifier # @option options [Array] :callbacks # @option options [Hash] :metadata # def initialize(component, = {}, = {}) @component = component @component_options = .each do |key, value| instance_variable_set("@#{key}", value) if respond_to?(key) end @callbacks ||= [] @metadata ||= {} end ## # Returns the identifier of the document. If no identifier was given a # unique one will be generated instead. # # @return [String] # def identifier return @identifier ||= SecureRandom.hex end ## # Returns a new instance of the component. # # @return [Object] # def component_instance return component.new() end end |
Instance Method Details
#component_instance ⇒ Object
Returns a new instance of the component.
66 67 68 |
# File 'lib/opener/daemons/configuration.rb', line 66 def component_instance return component.new() end |
#identifier ⇒ String
Returns the identifier of the document. If no identifier was given a unique one will be generated instead.
57 58 59 |
# File 'lib/opener/daemons/configuration.rb', line 57 def identifier return @identifier ||= SecureRandom.hex end |