pfrpg_skills 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +23 -0
- data/Rakefile +7 -0
- data/lib/pfrpg_skills.rb +6 -4
- data/lib/pfrpg_skills/skill.rb +38 -4
- data/lib/pfrpg_skills/skill/acrobatics.rb +1 -1
- data/lib/pfrpg_skills/skill/bluff.rb +1 -1
- data/lib/pfrpg_skills/skill/climb.rb +1 -1
- data/lib/pfrpg_skills/skill/craft.rb +1 -1
- data/lib/pfrpg_skills/skill/diplomacy.rb +1 -1
- data/lib/pfrpg_skills/skill/disable_device.rb +1 -1
- data/lib/pfrpg_skills/skill/disguise.rb +1 -1
- data/lib/pfrpg_skills/skill/escape_artist.rb +1 -1
- data/lib/pfrpg_skills/skill/fly.rb +1 -1
- data/lib/pfrpg_skills/skill/handle_animal.rb +1 -1
- data/lib/pfrpg_skills/skill/heal.rb +1 -1
- data/lib/pfrpg_skills/skill/intimidate.rb +1 -1
- data/lib/pfrpg_skills/skill/knowledge.rb +1 -1
- data/lib/pfrpg_skills/skill/linguistics.rb +1 -1
- data/lib/pfrpg_skills/skill/perception.rb +1 -1
- data/lib/pfrpg_skills/skill/perform.rb +1 -1
- data/lib/pfrpg_skills/skill/profession.rb +1 -1
- data/lib/pfrpg_skills/skill/ride.rb +1 -1
- data/lib/pfrpg_skills/skill/sense_motive.rb +1 -1
- data/lib/pfrpg_skills/skill/sleight_of_hand.rb +1 -1
- data/lib/pfrpg_skills/skill/spellcraft.rb +1 -1
- data/lib/pfrpg_skills/skill/stealth.rb +1 -1
- data/lib/pfrpg_skills/skill/survival.rb +1 -1
- data/lib/pfrpg_skills/skill/swim.rb +1 -1
- data/lib/pfrpg_skills/skill/use_magic_device.rb +1 -1
- data/lib/pfrpg_skills/version.rb +1 -1
- data/test/skills_test.rb +11 -0
- metadata +16 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3640f0b5e8617b50a13327dcdcf36c55c3681c3c
|
4
|
+
data.tar.gz: b43359dd154f4979ddca81ce128f874909c3cf9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2145b860e1808fc7321c98406e0a02673031ea483712befa03e9d74a9bea20e0ce4e1c77edb5e13c170f21c9f60591b4fc982b87c6f85d1c49eaa23ad24bccc2
|
7
|
+
data.tar.gz: f44d7ac981d3f7a1c17b7101753d1862e591dd670c7911b04e14b2afbd37ca7a01d115b7ee308e9894b33b4ce51144583afbf4b4b8b938c69cad00c07f6f56a0
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
[OSI Approved License]
|
3
|
+
The MIT License (MIT)
|
4
|
+
|
5
|
+
Copyright (c) 2014 HeroSheets, LLC
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
15
|
+
all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/pfrpg_skills.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'pfrpg_core/')) + "/**/*.rb"].each do |file|
|
2
|
-
require file
|
3
|
-
end
|
4
|
-
|
5
1
|
module PfrpgSkills
|
6
2
|
end
|
3
|
+
|
4
|
+
require 'pfrpg_skills/skill'
|
5
|
+
|
6
|
+
Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'pfrpg_skills/')) + "/**/*.rb"].each do |file|
|
7
|
+
require file
|
8
|
+
end
|
data/lib/pfrpg_skills/skill.rb
CHANGED
@@ -60,7 +60,8 @@ module PfrpgSkills
|
|
60
60
|
begin
|
61
61
|
type = type_from_name(name)
|
62
62
|
classname = class_from_name_with_type(name)
|
63
|
-
skill =
|
63
|
+
skill = self.constantize(classname).new(type)
|
64
|
+
|
64
65
|
return skill if skill.supported_types.include?(type)
|
65
66
|
rescue NameError => e
|
66
67
|
end
|
@@ -70,7 +71,7 @@ module PfrpgSkills
|
|
70
71
|
def self.typeless_class(name)
|
71
72
|
begin
|
72
73
|
classname = class_from_name(name)
|
73
|
-
skill =
|
74
|
+
skill = self.constantize(classname).new
|
74
75
|
return skill
|
75
76
|
rescue NameError => e
|
76
77
|
end
|
@@ -86,11 +87,44 @@ module PfrpgSkills
|
|
86
87
|
end
|
87
88
|
|
88
89
|
def self.class_from_name_with_type(name)
|
89
|
-
"Skill::#{name.split(':')[0].gsub(/\s+/, "")
|
90
|
+
"PfrpgSkills::Skill::#{self.camelize(name.split(':')[0].gsub(/\s+/, ""))}"
|
90
91
|
end
|
91
92
|
|
92
93
|
def self.class_from_name(name)
|
93
|
-
"Skill::#{name.gsub(/\s+/, "")
|
94
|
+
"PfrpgSkills::Skill::#{self.camelize(name.gsub(/\s+/, ""))}"
|
95
|
+
end
|
96
|
+
|
97
|
+
# By default, +camelize+ converts strings to UpperCamelCase. If the argument
|
98
|
+
# to +camelize+ is set to <tt>:lower</tt> then +camelize+ produces
|
99
|
+
# lowerCamelCase.
|
100
|
+
#
|
101
|
+
# +camelize+ will also convert '/' to '::' which is useful for converting
|
102
|
+
# paths to namespaces.
|
103
|
+
#
|
104
|
+
# 'active_model'.camelize # => "ActiveModel"
|
105
|
+
# 'active_model'.camelize(:lower) # => "activeModel"
|
106
|
+
# 'active_model/errors'.camelize # => "ActiveModel::Errors"
|
107
|
+
# 'active_model/errors'.camelize(:lower) # => "activeModel::Errors"
|
108
|
+
#
|
109
|
+
# As a rule of thumb you can think of +camelize+ as the inverse of
|
110
|
+
# +underscore+, though there are cases where that does not hold:
|
111
|
+
#
|
112
|
+
# 'SSLError'.underscore.camelize # => "SslError"
|
113
|
+
def self.camelize(term, uppercase_first_letter = true)
|
114
|
+
string = term.to_s
|
115
|
+
string = string.sub(/^[a-z\d]*/) { $&.capitalize }
|
116
|
+
string.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.constantize(term) #:nodoc:
|
120
|
+
names = term.split('::')
|
121
|
+
names.shift if names.empty? || names.first.empty?
|
122
|
+
|
123
|
+
constant = Object
|
124
|
+
names.each do |name|
|
125
|
+
constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
|
126
|
+
end
|
127
|
+
constant
|
94
128
|
end
|
95
129
|
|
96
130
|
end
|
data/lib/pfrpg_skills/version.rb
CHANGED
data/test/skills_test.rb
ADDED
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pfrpg_skills
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan OMara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1.
|
19
|
+
version: 4.1.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sqlite3
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
26
|
+
version: 4.1.7
|
41
27
|
description: skills
|
42
28
|
email:
|
43
29
|
- jordan@herosheets.com
|
@@ -45,8 +31,6 @@ executables: []
|
|
45
31
|
extensions: []
|
46
32
|
extra_rdoc_files: []
|
47
33
|
files:
|
48
|
-
- lib/pfrpg_skills.rb
|
49
|
-
- lib/pfrpg_skills/skill.rb
|
50
34
|
- lib/pfrpg_skills/skill/acrobatics.rb
|
51
35
|
- lib/pfrpg_skills/skill/appraise.rb
|
52
36
|
- lib/pfrpg_skills/skill/bluff.rb
|
@@ -73,7 +57,12 @@ files:
|
|
73
57
|
- lib/pfrpg_skills/skill/survival.rb
|
74
58
|
- lib/pfrpg_skills/skill/swim.rb
|
75
59
|
- lib/pfrpg_skills/skill/use_magic_device.rb
|
60
|
+
- lib/pfrpg_skills/skill.rb
|
76
61
|
- lib/pfrpg_skills/version.rb
|
62
|
+
- lib/pfrpg_skills.rb
|
63
|
+
- LICENSE
|
64
|
+
- Rakefile
|
65
|
+
- test/skills_test.rb
|
77
66
|
homepage: http://herosheets.com
|
78
67
|
licenses: []
|
79
68
|
metadata: {}
|
@@ -83,18 +72,19 @@ require_paths:
|
|
83
72
|
- lib
|
84
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
74
|
requirements:
|
86
|
-
- -
|
75
|
+
- - '>='
|
87
76
|
- !ruby/object:Gem::Version
|
88
77
|
version: '0'
|
89
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
requirements: []
|
95
84
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.0.14
|
97
86
|
signing_key:
|
98
87
|
specification_version: 4
|
99
88
|
summary: Generic PFRPG skills
|
100
|
-
test_files:
|
89
|
+
test_files:
|
90
|
+
- test/skills_test.rb
|