Class: Orbacle::Selfie

Inherits:
Object
  • Object
show all
Defined in:
lib/orbacle/selfie.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, scope) ⇒ Selfie

Returns a new instance of Selfie.



17
18
19
20
21
# File 'lib/orbacle/selfie.rb', line 17

def initialize(kind, scope)
  @kind = kind
  @scope = scope
  raise if ![:klass, :instance, :main].include?(kind)
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



35
36
37
# File 'lib/orbacle/selfie.rb', line 35

def kind
  @kind
end

#scopeObject (readonly)

Returns the value of attribute scope.



35
36
37
# File 'lib/orbacle/selfie.rb', line 35

def scope
  @scope
end

Class Method Details

.instance_from_scope(scope) ⇒ Object



9
10
11
# File 'lib/orbacle/selfie.rb', line 9

def self.instance_from_scope(scope)
  new(:instance, scope)
end

.klass_from_scope(scope) ⇒ Object



5
6
7
# File 'lib/orbacle/selfie.rb', line 5

def self.klass_from_scope(scope)
  new(:klass, scope)
end

.mainObject



13
14
15
# File 'lib/orbacle/selfie.rb', line 13

def self.main
  new(:main, nil)
end

Instance Method Details

#==(other) ⇒ Object



37
38
39
# File 'lib/orbacle/selfie.rb', line 37

def ==(other)
  @kind == other.kind && @scope == other.scope
end

#instance?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/orbacle/selfie.rb', line 27

def instance?
  @kind == :instance
end

#klass?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/orbacle/selfie.rb', line 23

def klass?
  @kind == :klass
end

#main?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/orbacle/selfie.rb', line 31

def main?
  @kind == :main
end