class DataMaps::Executable
Base class for executables (converter, when, then)
@since 0.0.1 @abstract @attr_reader @option the given option
Attributes
option[R]
Public Class Methods
new(option)
click to toggle source
Initializer
@param [mixed] option The given options
# File lib/data_maps/executable.rb, line 13 def initialize(option) @option = option self.after_initialize if self.respond_to? :after_initialize end
valid_collection?(collection)
click to toggle source
Helper method to check if all the executable in a collection are valid objects of self
@param [Array] collection
# File lib/data_maps/executable.rb, line 29 def self.valid_collection?(collection) collection.is_a?(Array) && collection.all?{ |w| w.is_a?(self) } end
Public Instance Methods
execute(data)
click to toggle source
The execute method to apply checks or mutations on the given data
@param [mixed] data
# File lib/data_maps/executable.rb, line 22 def execute(data) raise NotImplementedError.new("Please implement the execute method for your #{self.class.name}") end