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
|
# File 'lib/acts_as_span.rb', line 31
def acts_as_span(*args)
self.send(:extend, ActsAsSpan::ExtendedClassMethods)
self.send(:include, ActsAsSpan::IncludedInstanceMethods)
options = OpenStruct.new(args.last.is_a?(Hash) ? ActsAsSpan.options.merge(args.pop) : ActsAsSpan.options)
acts_as_span_definitions[options.name] = options
delegate :span_status,
:span_status_on,
:current?,
:current_on?,
:future?,
:future_on?,
:expired?,
:expired_on?,
:past?,
:past_on?, to: :span
delegate :acts_as_span_definitions, to: :class
class << self
delegate :current,
:current_on,
:future,
:future_on,
:expired,
:expired_on,
:past_on,
:past,
:current_or_future_on,
:current_or_future, to: :span
end
validate :validate_spans
end
|