stringglob 0.0.2 → 0.0.3

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/Makefile ADDED
@@ -0,0 +1,12 @@
1
+ GEM = pkg/stringglob-0.0.2.gem
2
+
3
+ default: build
4
+
5
+ build: gem
6
+
7
+ gem:
8
+ rake build
9
+
10
+ upload:
11
+ gem push $(GEM)
12
+
@@ -1,3 +1,3 @@
1
1
  module StringGlob
2
- VERSION = "0.0.2" ## :nodoc:
2
+ VERSION = "0.0.3" ## :nodoc:
3
3
  end
data/lib/stringglob.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  ## Author:: SATOH Fumiyasu
4
4
  ## Copyright:: (c) 2007-2011 SATOH Fumiyasu @ OSS Technology, Corp.
5
5
  ## License:: You can redistribute it and/or modify it under the same term as Ruby.
6
- ## Date:: 2011-06-21, since 2009-07-15
6
+ ## Date:: 2011-11-01, since 2009-07-15
7
7
  ##
8
8
 
9
9
  ## This is a Ruby version of Perl Text::Glob 0.08
@@ -13,11 +13,11 @@ require "stringglob/version"
13
13
 
14
14
  ## Generate a Regexp object from a glob(3) pattern
15
15
  module StringGlob
16
- ## Ignore case
16
+ ## Ignore case.
17
17
  IGNORE_CASE = 1 << 0
18
- ## Leading star '*' mathces leading dot '.'
18
+ ## Leading star '*' mathces leading dot '.'.
19
19
  STAR_MATCHES_LEADING_DOT = 1 << 1
20
- ## Star '*' mathces slash '/'
20
+ ## Star '*' mathces slash '/'.
21
21
  STAR_MATCHES_SLASH = 1 << 2
22
22
 
23
23
  ## Returns a Regex object which is the equivalent of the globbing pattern.
@@ -34,24 +34,23 @@ module StringGlob
34
34
  escaping = false
35
35
  first_byte = true
36
36
  asterisk = false
37
- strict_leading_dot = (opt & STAR_MATCHES_LEADING_DOT == 0)
38
- strict_wildcard_slash = (opt & STAR_MATCHES_SLASH == 0)
37
+ star_matches_leading_dot = (opt & STAR_MATCHES_LEADING_DOT == 0)
38
+ star_matches_slash = (opt & STAR_MATCHES_SLASH == 0)
39
39
  glob.scan(/./m) do |glob_c|
40
40
  if first_byte
41
- if strict_leading_dot
41
+ if star_matches_leading_dot
42
42
  re_str += '(?=[^\.])' unless glob_c == '.'
43
43
  end
44
44
  first_byte = false
45
45
  end
46
46
  if asterisk && glob_c != '*'
47
- re_str += strict_wildcard_slash ? '[^/]*' : '.*'
47
+ re_str += star_matches_slash ? '[^/]*' : '.*'
48
48
  asterisk = false
49
49
  end
50
50
  if glob_c == '/'
51
51
  first_byte = true
52
52
  end
53
- if (glob_c == '.' || glob_c == '(' || glob_c == ')' || glob_c == '|' ||
54
- glob_c == '+' || glob_c == '^' || glob_c == '$' || glob_c == '@' || glob_c == '%' )
53
+ if ('.()|+^$@%'.include?(glob_c))
55
54
  re_str += '\\' + glob_c
56
55
  elsif glob_c == '*'
57
56
  if escaping
@@ -64,7 +63,7 @@ module StringGlob
64
63
  end
65
64
  elsif glob_c == '?'
66
65
  re_str += escaping ? '\\?' :
67
- strict_wildcard_slash ? '[^/]' : '.'
66
+ star_matches_slash ? '[^/]' : '.'
68
67
  elsif glob_c == '{'
69
68
  re_str += escaping ? '\\{' : '('
70
69
  in_curlies += 1 unless escaping
@@ -90,7 +89,7 @@ module StringGlob
90
89
  escaping = false
91
90
  end
92
91
  if asterisk
93
- re_str += strict_wildcard_slash ? '[^/]*' : '.*'
92
+ re_str += star_matches_slash ? '[^/]*' : '.*'
94
93
  end
95
94
 
96
95
  re_str = "(?i:#{re_str})" if (opt & IGNORE_CASE != 0)
data/stringglob.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = StringGlob::VERSION
8
8
  s.authors = ["SATOH Fumiyasu"]
9
9
  s.email = ["fumiyas@osstech.co.jp"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/fumiyas/ruby-stringglob"
11
11
  s.summary = %q{Generate a Regexp object from a glob(3) pattern}
12
12
  s.description = %q{Generate a Regexp object from a glob(3) pattern}
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stringglob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2011-10-31 00:00:00.000000000 Z
12
+ date: 2011-11-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Generate a Regexp object from a glob(3) pattern
15
15
  email:
@@ -20,12 +20,13 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - .gitignore
22
22
  - Gemfile
23
+ - Makefile
23
24
  - Rakefile
24
25
  - lib/stringglob.rb
25
26
  - lib/stringglob/version.rb
26
27
  - stringglob.gemspec
27
28
  - test/test_stringglob.rb
28
- homepage: ''
29
+ homepage: https://github.com/fumiyas/ruby-stringglob
29
30
  licenses: []
30
31
  post_install_message:
31
32
  rdoc_options: []
@@ -45,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
46
  version: '0'
46
47
  requirements: []
47
48
  rubyforge_project: stringglob
48
- rubygems_version: 1.8.10
49
+ rubygems_version: 1.8.11
49
50
  signing_key:
50
51
  specification_version: 3
51
52
  summary: Generate a Regexp object from a glob(3) pattern