Sha256: b278cafd93e608769b2d9e0fb1f6a5d47b1ac909b0aeeb86235b7931bab380d5
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
module Legato module Model def self.extended(base) ProfileMethods.add_profile_method(base) end def metrics(*fields) @metrics ||= ListParameter.new(:metrics) @metrics << fields end def dimensions(*fields) @dimensions ||= ListParameter.new(:dimensions) @dimensions << fields end def filters @filters ||= {} end def filter(name, &block) filters[name] = block (class << self; self; end).instance_eval do define_method(name) {|*args| Query.new(self).apply_filter(*args, &block)} end end def segments @segments ||= {} end def segment(name, &block) segments[name] = block (class << self; self; end).instance_eval do define_method(name) {|*args| Query.new(self).apply_segment_filter(*args, &block)} end end def set_instance_klass(klass) @instance_klass = klass end def instance_klass @instance_klass || OpenStruct end def results(profile, options = {}) Query.new(self).results(profile, options) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
legato-0.3.0 | lib/legato/model.rb |
legato-0.2.0 | lib/legato/model.rb |
legato-0.1.0 | lib/legato/model.rb |