smalltalkable 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,12 +18,14 @@ Smalltalkable allows you to write ruby code in smalltalkish way.
18
18
 
19
19
  require 'smalltalkable'
20
20
 
21
+ # define class
21
22
  Object.subclass :Counter,
22
23
  instanceVariableNames: 'value step',
23
24
  classVariableNames: 'instanceCount',
24
25
  poolDictionaries: '',
25
26
  category: 'Category-Name'
26
27
 
28
+ # define methods
27
29
  Counter.compile '
28
30
  initialize value, step:step
29
31
  @value = value
@@ -38,6 +40,7 @@ Smalltalkable allows you to write ruby code in smalltalkish way.
38
40
  setValue newValue
39
41
  @value = newValue'
40
42
 
43
+ # use defined class
41
44
  counter = Counter.new 0, step:2
42
45
  ->{counter.value < 20}.while_true ->{
43
46
  (counter.value % 3 == 0).if_true ->{
@@ -63,8 +66,8 @@ To define smalltalkish methods in rubyish way, use smalltalkize method:
63
66
  do_something
64
67
  end
65
68
  smalltalkize :method, :arg2
66
- # Usage: Counter.new.method 'arg1', arg2:'arg2'
67
69
  end
70
+ # Usage: Counter.new.method 'arg1', arg2:'arg2'
68
71
 
69
72
  This can be used to smalltalkize an existing method:
70
73
 
@@ -1,3 +1,3 @@
1
1
  module Smalltalkable
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -41,16 +41,11 @@ class TestSmalltalkable < Test::Unit::TestCase
41
41
  end
42
42
 
43
43
  def test_define_class_method
44
- Counter.singleton_class.compile '
44
+ Counter.class_compile '
45
45
  classMethod
46
46
  "classMethod"'
47
47
  assert_raise NoMethodError do String.classMethod end
48
48
  assert_equal 'classMethod', Counter.classMethod
49
-
50
- Counter.class_compile '
51
- classMethod2
52
- "classMethod2"'
53
- assert_equal 'classMethod2', Counter.classMethod2
54
49
  end
55
50
 
56
51
  def test_smalltalkize
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smalltalkable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-19 00:00:00.000000000 Z
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Smalltalkable is a library to write your ruby code in smalltalkish way.
15
15
  email: