tinydns-data 0.0.1 → 0.0.2

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.
@@ -7,15 +7,36 @@ module TinyDNS
7
7
  end
8
8
 
9
9
  def type
10
- self[:type]
10
+ case self[:type]
11
+ when "C"
12
+ :cname
13
+ when "="
14
+ :a
15
+ when "@"
16
+ :mx
17
+ when "."
18
+ :soa
19
+ when "'"
20
+ :text
21
+ else
22
+ self[:type]
23
+ end
11
24
  end
12
25
 
13
26
  def name
14
27
  self[:name]
15
28
  end
16
29
 
30
+ def value
31
+ self[:value]
32
+ end
33
+
34
+ def ttl
35
+ self[:ttl]
36
+ end
37
+
17
38
  def to_str
18
- str = "#{type}#{name}:#{self[:value]}:#{self[:ttl]}"
39
+ str = "#{self[:type]}#{name}:#{value}:#{ttl}"
19
40
  if self[:other]
20
41
  str << ":#{self[:other]}"
21
42
  end
@@ -1,3 +1,3 @@
1
1
  module TinyDNS
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -10,4 +10,12 @@ describe TinyDNS::Record do
10
10
  )
11
11
  @record.to_str.should eql("=example.com:1.2.3.4:3600")
12
12
  end
13
+
14
+ it "types" do
15
+ TinyDNS::Record.new(:type => '=').type.should eql(:a)
16
+ TinyDNS::Record.new(:type => 'C').type.should eql(:cname)
17
+ TinyDNS::Record.new(:type => '@').type.should eql(:mx)
18
+ TinyDNS::Record.new(:type => '.').type.should eql(:soa)
19
+ TinyDNS::Record.new(:type => "'").type.should eql(:text)
20
+ end
13
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinydns-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  segments:
95
95
  - 0
96
- hash: -2534397281966057005
96
+ hash: 3152463631868750145
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: -2534397281966057005
105
+ hash: 3152463631868750145
106
106
  requirements: []
107
107
  rubyforge_project:
108
108
  rubygems_version: 1.8.25