dun 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/dun.rb +13 -3
  2. metadata +4 -9
data/lib/dun.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dun
2
- class Activity
2
+ class Land
3
3
  attr_reader :data
4
4
 
5
5
  def self.inherited subclass
@@ -32,6 +32,14 @@ module Dun
32
32
 
33
33
  end
34
34
 
35
+ def default attr, default_value
36
+ orig_attr = "#{attr}_without_default"
37
+ alias_method orig_attr, attr
38
+ define_method attr do
39
+ send(orig_attr) || default_value
40
+ end
41
+ end
42
+
35
43
  def set attr, value
36
44
  define_method(attr) {value}
37
45
  end
@@ -55,10 +63,12 @@ module Dun
55
63
  instance_variable_set "@#{attr}", value
56
64
  end
57
65
 
58
- def default attr, value
59
- instance_variable_set "@#{attr}", value if send(attr).nil?
66
+ def default attr, default_value
67
+ instance_variable_set "@#{attr}", default_value if send(attr).nil?
60
68
  end
61
69
 
62
70
  end
63
71
 
72
+ Activity = Land
73
+
64
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-05 00:00:00.000000000 Z
12
+ date: 2013-12-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! 'Dun is a dark color in english, and it is also the pinyin of the chinese
15
- character 钝 means not sharp.
16
-
17
- Dun help ruby programers focus on the problem domain directly when programing.
18
-
19
- '
14
+ description: Dun help ruby programers focus on the problem domain directly when programing.
20
15
  email: kayak.jiang@gmail.com
21
16
  executables: []
22
17
  extensions: []
@@ -44,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
39
  version: '0'
45
40
  requirements: []
46
41
  rubyforge_project:
47
- rubygems_version: 1.8.24
42
+ rubygems_version: 1.8.25
48
43
  signing_key:
49
44
  specification_version: 3
50
45
  summary: Dun help ruby programers focus on the problem domain directly when programing.