Class: Realm::ActionHandler::Result

Inherits:
Array
  • Object
show all
Defined in:
lib/realm/action_handler/result.rb

Overview

Tuple of label and value

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](first, second = nil) ⇒ Object



7
8
9
10
11
# File 'lib/realm/action_handler/result.rb', line 7

def self.[](first, second = nil)
  return new(first, second).freeze if first.is_a?(Symbol) || first.is_a?(Realm::Event)

  new(second || :ok, first).freeze
end

Instance Method Details

#eventObject



17
18
19
# File 'lib/realm/action_handler/result.rb', line 17

def event
  label if label.is_a?(Realm::Event)
end

#labelObject



13
14
15
# File 'lib/realm/action_handler/result.rb', line 13

def label
  self[0]
end

#valueObject



21
22
23
# File 'lib/realm/action_handler/result.rb', line 21

def value
  self[1]
end