Class: Code::Object::Class

Inherits:
Code::Object show all
Defined in:
lib/code/object/class.rb

Instance Attribute Summary

Attributes inherited from Code::Object

#raw

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Code::Object

#<=>, #==, call, #code_and_operator, code_and_operator, #code_different, code_different, code_equal_equal, #code_equal_equal, code_equal_equal_equal, #code_equal_equal_equal, code_exclamation_point, #code_exclamation_point, code_exclusive_range, #code_exclusive_range, #code_inclusive_range, code_inclusive_range, code_new, code_or_operator, #code_or_operator, code_self, #code_self, #code_to_string, code_to_string, falsy?, #falsy?, #hash, inspect, maybe, multi_fetch, #multi_fetch, repeat, #sig, sig, #to_json, to_s, truthy?, #truthy?, |

Constructor Details

#initialize(*args, **_kargs, &_block) ⇒ Class

Returns a new instance of Class.



6
7
8
9
10
11
12
# File 'lib/code/object/class.rb', line 6

def initialize(*args, **_kargs, &_block)
  raw = args.first || Nothing.new
  raw = raw.raw if raw.is_a?(Class)
  raw = raw.class if raw.is_an?(Object)
  @raw = raw
  super
end

Class Method Details

.nameObject



26
27
28
# File 'lib/code/object/class.rb', line 26

def self.name
  "Class"
end

Instance Method Details

#as_jsonObject



30
31
32
# File 'lib/code/object/class.rb', line 30

def as_json(...)
  raw.name.as_json(...)
end

#callObject



14
15
16
# File 'lib/code/object/class.rb', line 14

def call(...)
  raw.call(...)
end

#inspectObject



22
23
24
# File 'lib/code/object/class.rb', line 22

def inspect
  to_s
end

#to_sObject



18
19
20
# File 'lib/code/object/class.rb', line 18

def to_s
  raw.name
end