class AzaharaSchema::Outputs
Public Class Methods
new(schema)
click to toggle source
# File lib/azahara_schema/outputs.rb, line 23 def initialize(schema) @schema = schema end
output_class(output)
click to toggle source
# File lib/azahara_schema/outputs.rb, line 19 def self.output_class(output) registered_outputs[output] end
register(klass)
click to toggle source
# File lib/azahara_schema/outputs.rb, line 10 def self.register(klass) key = klass.key registered_outputs[key] = klass define_method(key) do output(key) end true end
registered_outputs()
click to toggle source
# File lib/azahara_schema/outputs.rb, line 6 def self.registered_outputs @registered_outputs ||= {} end
Public Instance Methods
each() { |output(o)| ... }
click to toggle source
# File lib/azahara_schema/outputs.rb, line 31 def each(&block) @schema.enabled_outputs.each do |o| yield output(o) end end
output(output)
click to toggle source
# File lib/azahara_schema/outputs.rb, line 27 def output(output) self.class.output_class(output).new(@schema) end