forked from ryankinderman/metakoans_training
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorganized koans and cleaned up permutations
- Loading branch information
1 parent
8844956
commit 8733a10
Showing
12 changed files
with
133 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module MetaKoans | ||
|
||
class SomeClass | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
module MetaKoans | ||
|
||
class SomeClass | ||
def self.attribute; end | ||
def self.attribute | ||
end | ||
|
||
def a? | ||
false | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
module MetaKoans | ||
|
||
class SomeClass | ||
def self.attribute; end | ||
|
||
def self.attribute | ||
end | ||
|
||
def a? | ||
false | ||
end | ||
|
||
def a=(value) | ||
@val = value | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
module MetaKoans | ||
|
||
class SomeClass | ||
def self.attribute(name='a'); end | ||
|
||
def a? | ||
!@a.nil? | ||
end | ||
|
||
def a | ||
@a | ||
def self.attribute(name='a') | ||
define_method name + "?" do | ||
!@val.nil? | ||
end | ||
define_method name + "=" do |value| | ||
@val = value | ||
end | ||
define_method name do | ||
@val | ||
end | ||
end | ||
|
||
def a=(value) | ||
@a = value | ||
end | ||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
module MetaKoans | ||
|
||
class SomeClass | ||
|
||
class << self | ||
def self.attribute(name='a') | ||
attr_accessor name | ||
define_method name + "?" do | ||
!send(name).nil? | ||
!@val.nil? | ||
end | ||
define_method name + "=" do |value| | ||
@val = value | ||
end | ||
end | ||
define_method name do | ||
@val | ||
end | ||
end | ||
end | ||
|
||
def self.attribute(name='a') | ||
attr_accessor name | ||
define_method name + "?" do | ||
!send(name).nil? | ||
!@val.nil? | ||
end | ||
end | ||
define_method name + "=" do |value| | ||
@val = value | ||
end | ||
define_method name do | ||
@val | ||
end | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module MetaKoans | ||
|
||
module Attributable | ||
def attribute(name='a') | ||
define_method name + "?" do | ||
!@val.nil? | ||
end | ||
define_method name + "=" do |value| | ||
@val = value | ||
end | ||
define_method name do | ||
@val | ||
end | ||
end | ||
end | ||
|
||
class SomeClass | ||
end | ||
|
||
end | ||
|
||
class Class | ||
include MetaKoans::Attributable | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters