Class: Wisper::ValueObjects::Prefix Private

Inherits:
String
  • Object
show all
Defined in:
lib/wisper/value_objects/prefix.rb

Overview

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

Prefix for notifications

Examples:

Wisper::ValueObjects::Prefix.new nil    # => ""
Wisper::ValueObjects::Prefix.new "when" # => "when_"
Wisper::ValueObjects::Prefix.new true   # => "on_"

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil) ⇒ undefined

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.

Parameters:

  • value (true, nil, #to_s) (defaults to: nil)


17
18
19
20
# File 'lib/wisper/value_objects/prefix.rb', line 17

def initialize(value = nil)
  super "#{ (value == true) ? default : value }_"
  replace "" if self == "_"
end

Class Attribute Details

.defaultObject

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.



11
12
13
# File 'lib/wisper/value_objects/prefix.rb', line 11

def default
  @default
end