Module: Safe::SafeHelper

Defined in:
lib/universum/event.rb

Overview

class Event

Instance Method Summary collapse

Instance Method Details

#event(class_name, *args) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/universum/event.rb', line 69

def event( class_name, *args )
  ########################################
  # note: lets you use:
  #   enum :Color, :red, :green, :blue
  #    -or-
  #   enum :Color, [:red, :green, :blue]
  if args[0].is_a?( Array )
    fields = args[0]
  else
    fields = args
  end

  Event.new( class_name, *fields )
end