Class: Orbacle::Selfie
- Inherits:
-
Object
- Object
- Orbacle::Selfie
- Defined in:
- lib/orbacle/selfie.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(kind, scope) ⇒ Selfie
constructor
A new instance of Selfie.
- #instance? ⇒ Boolean
- #klass? ⇒ Boolean
- #main? ⇒ Boolean
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
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
35 36 37 |
# File 'lib/orbacle/selfie.rb', line 35 def kind @kind end |
#scope ⇒ Object (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 |
.main ⇒ Object
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
27 28 29 |
# File 'lib/orbacle/selfie.rb', line 27 def instance? @kind == :instance end |
#klass? ⇒ Boolean
23 24 25 |
# File 'lib/orbacle/selfie.rb', line 23 def klass? @kind == :klass end |
#main? ⇒ Boolean
31 32 33 |
# File 'lib/orbacle/selfie.rb', line 31 def main? @kind == :main end |