spf 0.0.22 → 0.0.23

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/lib/spf/model.rb CHANGED
@@ -85,15 +85,17 @@ class SPF::Term
85
85
  ::
86
86
  "
87
87
 
88
- attr_reader :errors, :ip_netblocks, :ip_address, :ip_network, :ipv4_prefix_length, :ipv6_prefix_length, :domain_spec
88
+ attr_reader :errors, :ip_netblocks, :ip_address, :ip_network, :ipv4_prefix_length, :ipv6_prefix_length, :domain_spec, :raw_params
89
89
 
90
90
  def initialize(options = {})
91
91
  @ip_address = nil
92
92
  @ip_network = nil
93
93
  @ipv4_prefix_length = nil
94
94
  @ipv6_prefix_length = nil
95
+ @raw_params = nil
95
96
  @errors = []
96
97
  @ip_netblocks = []
98
+ @text = options[:text]
97
99
  @raise_exceptions = options.has_key?(:raise_exceptions) ? options[:raise_exceptions] : true
98
100
  end
99
101
 
@@ -103,7 +105,6 @@ class SPF::Term
103
105
  end
104
106
 
105
107
  def self.new_from_string(text, options = {})
106
- #term = SPF::Term.new(options, {:text => text})
107
108
  options[:text] = text
108
109
  term = self.new(options)
109
110
  term.parse
@@ -122,6 +123,7 @@ class SPF::Term
122
123
  end
123
124
 
124
125
  def parse_ipv4_address(required = false)
126
+ @raw_params = @parse_text.dup
125
127
  if @parse_text.sub!(/^(#{IPV4_ADDRESS_PATTERN})/x, '')
126
128
  @ip_address = $1
127
129
  elsif required
@@ -151,6 +153,7 @@ class SPF::Term
151
153
  end
152
154
 
153
155
  def parse_ipv4_network(required = false)
156
+ @raw_params = @parse_text.dup
154
157
  self.parse_ipv4_address(required)
155
158
  self.parse_ipv4_prefix_length
156
159
  begin
@@ -189,6 +192,7 @@ class SPF::Term
189
192
  end
190
193
 
191
194
  def parse_ipv6_network(required = false)
195
+ @raw_params = @parse_text.dup
192
196
  self.parse_ipv6_address(required)
193
197
  self.parse_ipv6_prefix_length
194
198
  begin
@@ -285,9 +289,11 @@ class SPF::Mech < SPF::Term
285
289
  end
286
290
 
287
291
  def parse_params(required = true)
292
+ @raw_params = @parse_text.dup
288
293
  # Parse generic string of parameters text (should be overridden in sub-classes):
289
294
  if @parse_text.sub!(/^(.*)/, '')
290
295
  @params_text = $1
296
+ @raw_params = @params_text.dup
291
297
  end
292
298
  end
293
299
 
@@ -366,6 +372,7 @@ class SPF::Mech < SPF::Term
366
372
  NAME = 'a'
367
373
 
368
374
  def parse_params(required = true)
375
+ @raw_params = @parse_text.dup
369
376
  self.parse_domain_spec
370
377
  self.parse_ipv4_ipv6_prefix_lengths
371
378
  end
@@ -410,6 +417,7 @@ class SPF::Mech < SPF::Term
410
417
  NAME = 'exists'
411
418
 
412
419
  def parse_params(required = true)
420
+ @raw_params = @raw_text.dup
413
421
  self.parse_domain_spec(required)
414
422
  # Other method of denoting "potentially ~infinite" netblocks?
415
423
  @ip_netblocks << nil
@@ -486,6 +494,8 @@ class SPF::Mech < SPF::Term
486
494
  params = @ip_network.to_addr
487
495
  params += '/' + @ip_network.pfxlen.to_s if
488
496
  @ip_network.pfxlen != self.default_ipv6_prefix_length
497
+ puts "params: #{params}"
498
+ puts self.inspect
489
499
  return params
490
500
  end
491
501
 
@@ -505,6 +515,7 @@ class SPF::Mech < SPF::Term
505
515
  end
506
516
 
507
517
  def parse_params(required = true)
518
+ @raw_params = @parse_text.dup
508
519
  self.parse_domain_spec(required)
509
520
  end
510
521
 
@@ -557,6 +568,7 @@ class SPF::Mech < SPF::Term
557
568
  NAME = 'mx'
558
569
 
559
570
  def parse_params(required = true)
571
+ @raw_params = @parse_text.dup
560
572
  self.parse_domain_spec
561
573
  self.parse_ipv4_ipv6_prefix_lengths
562
574
  end
@@ -609,6 +621,7 @@ class SPF::Mech < SPF::Term
609
621
  NAME = 'ptr'
610
622
 
611
623
  def parse_params(required = true)
624
+ @raw_params = @parse_text.dup
612
625
  self.parse_domain_spec
613
626
  end
614
627
 
data/lib/spf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module SPF
2
- VERSION = '0.0.22'
2
+ VERSION = '0.0.23'
3
3
  end
4
4
 
5
5
  # vim:sw=2 sts=2
data/spf.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "spf"
8
- s.version = "0.0.22"
8
+ s.version = "0.0.23"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Flury", "Julian Mehnle"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: