pwm 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -0
  2. data/lib/pwm.rb +22 -3
  3. data/lib/pwm/version.rb +1 -1
  4. metadata +1 -1
data/Rakefile CHANGED
@@ -4,3 +4,4 @@ require 'rspec/core/rake_task'
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+ task :test => :spec
data/lib/pwm.rb CHANGED
@@ -1,12 +1,31 @@
1
1
  require "pwm/version"
2
2
 
3
3
  module Pwm
4
+
5
+ # Internal: The set of characters from which passwords will be assembled.
6
+ # This could be overridden if you don't like the default.
7
+ #
8
+ # Returns the set of characters as an Array.
4
9
  def self.characters
5
- (('A'..'Z').to_a + ('a'..'z').to_a + ('2'..'9').to_a) - ['I', 'O', 'l']
10
+ (('A'..'Z').to_a + ('a'..'z').to_a +
11
+ ('2'..'9').to_a) - ['I', 'O', 'l']
6
12
  end
7
13
 
8
- def self.password(length=16)
9
- (0..length-1).inject('') do |pw, n|
14
+ # Public: Generate a password.
15
+ #
16
+ # length - The length of the password.
17
+ #
18
+ # Examples
19
+ #
20
+ # Pwm.password
21
+ # # => 'SPdHeZnn9rut4AUz'
22
+ #
23
+ # Pwm.password(8)
24
+ # # => 'oUX4fmqr'
25
+ #
26
+ # Returns the generated password as a String.
27
+ def self.password(length = 16)
28
+ (0..length - 1).inject('') do |pw, n|
10
29
  pw + characters[rand(characters.length)]
11
30
  end
12
31
  end
data/lib/pwm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pwm
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: