Module: Celerity::DisabledElement

Includes:
Exception
Included in:
InputElement, Option
Defined in:
lib/celerity/disabled_element.rb

Overview

Mixed in to all elements that can have the 'disabled' attribute.

Instance Method Summary collapse

Instance Method Details

#assert_enabledObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Used internally.


33
34
35
36
37
# File 'lib/celerity/disabled_element.rb', line 33

def assert_enabled
  if disabled?
    raise ObjectDisabledException, "Object #{identifier_string} is disabled"
  end
end

#disabled?Boolean Also known as: disabled

Returns true if the element is disabled.

Returns:

  • (Boolean)

22
23
24
25
# File 'lib/celerity/disabled_element.rb', line 22

def disabled?
  assert_exists unless defined?(@object) && @object
  @object.isDisabled
end

#enabled?Boolean

Returns false if the element is disabled.

Returns:

  • (Boolean)

14
15
16
# File 'lib/celerity/disabled_element.rb', line 14

def enabled?
  !disabled?
end