Class: RVM::Classes::Boolean

Inherits:
Class
  • Object
show all
Defined in:
lib/rvm/classes/boolean.rb

Instance Method Summary collapse

Methods inherited from Class

#functions, #method_missing, #variables

Methods included from Plugin

#helper, #included, #plugin_host, #plugin_id, #register_for

Constructor Details

#initialize(value) ⇒ Boolean

Returns a new instance of Boolean.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rvm/classes/boolean.rb', line 22

def initialize value
  super()
  if value
    if value.respond_to? :is_true?
      @value = value.is_true?
    else
      @value = true
    end
  else
    @value = false
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RVM::Classes::Class

Instance Method Details

#data_typeObject



6
7
8
# File 'lib/rvm/classes/boolean.rb', line 6

def data_type
  :boolean
end

#eql?(o) ⇒ Boolean

Returns:



14
15
16
17
18
19
20
# File 'lib/rvm/classes/boolean.rb', line 14

def eql?(o)
  if o.is_a?(RVM::Classes::Boolean)
    o.is_true? == is_true?
  else
    @value == o
  end
end

#hashObject



10
11
12
# File 'lib/rvm/classes/boolean.rb', line 10

def hash
  @value.hash
end

#is_true?Boolean

Returns:



35
36
37
# File 'lib/rvm/classes/boolean.rb', line 35

def is_true?
  @value
end