Class: Just
- Inherits:
-
Object
- Object
- Just
- Defined in:
- lib/just_maybe/just.rb
Instance Method Summary collapse
-
#initialize(object) ⇒ Just
constructor
A new instance of Just.
- #nothing? ⇒ Boolean
- #something? ⇒ Boolean
- #to_s ⇒ Object
- #try {|@object| ... } ⇒ Object
Constructor Details
#initialize(object) ⇒ Just
Returns a new instance of Just.
2 3 4 |
# File 'lib/just_maybe/just.rb', line 2 def initialize(object) @object = object end |
Instance Method Details
#nothing? ⇒ Boolean
6 7 8 |
# File 'lib/just_maybe/just.rb', line 6 def nothing? false end |
#something? ⇒ Boolean
10 11 12 |
# File 'lib/just_maybe/just.rb', line 10 def something? true end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/just_maybe/just.rb', line 18 def to_s "Just: #{@object}" end |
#try {|@object| ... } ⇒ Object
14 15 16 |
# File 'lib/just_maybe/just.rb', line 14 def try yield @object if block_given? end |