class Snowly::ProtocolSchemaFinder

Constants

PROTOCOL_FILE_NAME

Attributes

schema[R]

Public Class Methods

new(custom_schema = nil) click to toggle source
# File lib/snowly/protocol_schema_finder.rb, line 6
def initialize(custom_schema = nil)
  @custom_schema = custom_schema
  @schema = load_protocol_schema
end

Public Instance Methods

alternative_protocol_schema() click to toggle source
# File lib/snowly/protocol_schema_finder.rb, line 24
def alternative_protocol_schema
  Dir[File.join(resolver,"/**/*")].select{ |f| File.basename(f) == PROTOCOL_FILE_NAME }[0]
end
find_protocol_schema() click to toggle source
# File lib/snowly/protocol_schema_finder.rb, line 11
def find_protocol_schema
  return @custom_schema if @custom_schema
  if resolver && alternative_protocol_schema
    alternative_protocol_schema
  else
    File.expand_path("../../schemas/#{PROTOCOL_FILE_NAME}", __FILE__)
  end
end
load_protocol_schema() click to toggle source

Loads the protocol schema created to describe snowplow events table attributes @return [Hash] parsed schema

# File lib/snowly/protocol_schema_finder.rb, line 30
def load_protocol_schema
  JSON.parse File.read(find_protocol_schema)
end
resolver() click to toggle source
# File lib/snowly/protocol_schema_finder.rb, line 20
def resolver
  Snowly.development_iglu_resolver_path
end