aska 0.0.6 → 0.0.7
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.
- data/Rakefile +1 -1
- data/aska.gemspec +2 -2
- data/lib/aska.rb +8 -2
- data/spec/rules_spec.rb +4 -1
- metadata +1 -1
data/Rakefile
CHANGED
data/aska.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Aska-0.0.
|
2
|
+
# Gem::Specification for Aska-0.0.7
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
--- !ruby/object:Gem::Specification
|
6
6
|
name: aska
|
7
7
|
version: !ruby/object:Gem::Version
|
8
|
-
version: 0.0.
|
8
|
+
version: 0.0.7
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Ari Lerner
|
data/lib/aska.rb
CHANGED
@@ -25,13 +25,13 @@ module Aska
|
|
25
25
|
attr_writer k.to_sym unless respond_to?("#{k}=".to_sym)
|
26
26
|
end
|
27
27
|
def look_up_rules(name)
|
28
|
-
defined_rules[name.to_sym] ||=
|
28
|
+
defined_rules[name.to_sym] ||= Rules.new
|
29
29
|
end
|
30
30
|
def are_rules?(name)
|
31
31
|
!look_up_rules(name).empty?
|
32
32
|
end
|
33
33
|
def aska_attr_accessors
|
34
|
-
@@aska_attr_accessors ||=
|
34
|
+
@@aska_attr_accessors ||= Rules.new
|
35
35
|
end
|
36
36
|
def defined_rules
|
37
37
|
@defined_rules ||= {}
|
@@ -101,4 +101,10 @@ module Aska
|
|
101
101
|
receiver.extend ClassMethods
|
102
102
|
receiver.send :include, InstanceMethods
|
103
103
|
end
|
104
|
+
|
105
|
+
class Rules < Array
|
106
|
+
def to_s
|
107
|
+
"\"#{self.join('", "')}\""
|
108
|
+
end
|
109
|
+
end
|
104
110
|
end
|
data/spec/rules_spec.rb
CHANGED
@@ -16,7 +16,10 @@ describe "Rules" do
|
|
16
16
|
@car.rules.class.should == Hash
|
17
17
|
end
|
18
18
|
it "should be able to look up the rules based on the name into an array" do
|
19
|
-
@car.names.class.should ==
|
19
|
+
@car.names.class.should == Aska::Rules
|
20
|
+
end
|
21
|
+
it "should be able to turn them into a string" do
|
22
|
+
@car.names.to_s.should == "\"x>0\", \"y>0\", \"x>y\""
|
20
23
|
end
|
21
24
|
it "should be able to say that rules are defined when they are defined" do
|
22
25
|
@car.names.should_not be_nil
|