Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Classes/Fancy/classes.fancy
Normal file
26
Task/Classes/Fancy/classes.fancy
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
class MyClass {
|
||||
read_slot: 'instance_var # creates getter method for @instance_var
|
||||
@@class_var = []
|
||||
|
||||
def initialize {
|
||||
# 'initialize' is the constructor method invoked during 'MyClass.new' by convention
|
||||
@instance_var = 0
|
||||
}
|
||||
|
||||
def some_method {
|
||||
@instance_var = 1
|
||||
@another_instance_var = "foo"
|
||||
}
|
||||
|
||||
# define class methods: define a singleton method on the class object
|
||||
def self class_method {
|
||||
# ...
|
||||
}
|
||||
|
||||
# you can also name the class object itself
|
||||
def MyClass class_method {
|
||||
# ...
|
||||
}
|
||||
}
|
||||
|
||||
myclass = MyClass new
|
||||
Loading…
Add table
Add a link
Reference in a new issue