morph 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/README +5 -5
- data/Rakefile +1 -1
- data/lib/morph.rb +2 -1
- data/morph.gemspec +4 -4
- data/spec/lib/morph_spec.rb +1 -1
- metadata +6 -6
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen
|
1
|
+
Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen scraping fun.
|
2
2
|
|
3
3
|
|
4
4
|
== Morph creating classes +from_xml+
|
@@ -16,11 +16,11 @@ Here's example code showing Morph playing with XML:
|
|
16
16
|
<name>Allerdale Borough Council</name>
|
17
17
|
</council>
|
18
18
|
</councils>]
|
19
|
-
|
19
|
+
|
20
20
|
councils = Morph.from_xml(xml)
|
21
21
|
# => [#<Morph::Council @code="1", @name="Aberdeen City Council">,
|
22
22
|
#<Morph::Council @code="2", @name="Allerdale Borough Council">]
|
23
|
-
|
23
|
+
|
24
24
|
councils.first.name
|
25
25
|
# => "Aberdeen City Council"
|
26
26
|
|
@@ -33,10 +33,10 @@ Here's example code showing Morph playing with TSV (tab-separated values):
|
|
33
33
|
tsv = %Q[name\tparty\nTed Roe\tred\nAli Davidson\tblue\nSue Smith\tgreen]
|
34
34
|
|
35
35
|
people = Morph.from_tsv(tsv, 'person')
|
36
|
-
# => [#<Morph::Person @name="Ted Roe", @party="red">,
|
36
|
+
# => [#<Morph::Person @name="Ted Roe", @party="red">,
|
37
37
|
#<Morph::Person @name="Ali Davidson", @party="blue">,
|
38
38
|
#<Morph::Person @name="Sue Smith", @party="green">]
|
39
|
-
|
39
|
+
|
40
40
|
people.last.party
|
41
41
|
# => "green"
|
42
42
|
|
data/Rakefile
CHANGED
@@ -17,8 +17,8 @@ begin
|
|
17
17
|
m.description = File.readlines("README").first
|
18
18
|
m.rubyforge_name = "morph"
|
19
19
|
m.rdoc_options << '--inline-source'
|
20
|
-
m.dependencies = ["activesupport >=2.0.2"]
|
21
20
|
m.rdoc_pattern = ["README", "CHANGELOG", "LICENSE"]
|
21
|
+
m.dependencies = ["activesupport >=2.0.2"]
|
22
22
|
end
|
23
23
|
|
24
24
|
rescue LoadError
|
data/lib/morph.rb
CHANGED
@@ -18,7 +18,7 @@ rescue Exception => e
|
|
18
18
|
end
|
19
19
|
|
20
20
|
module Morph
|
21
|
-
VERSION = "0.3.
|
21
|
+
VERSION = "0.3.2" unless defined? Morph::VERSION
|
22
22
|
|
23
23
|
class << self
|
24
24
|
def generate_migrations object, options={}
|
@@ -157,6 +157,7 @@ module Morph
|
|
157
157
|
|
158
158
|
def add_to_object object, attributes, namespace
|
159
159
|
attributes.each do |name, value|
|
160
|
+
name = name.to_s if name.is_a?(Symbol)
|
160
161
|
attribute = name.gsub(':',' ').underscore
|
161
162
|
case value
|
162
163
|
when String, Date, Time, TrueClass, FalseClass, Fixnum, Float
|
data/morph.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{morph}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Rob McKinnon"]
|
9
|
-
s.date = %q{2010-10-
|
10
|
-
s.description = %q{Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen
|
9
|
+
s.date = %q{2010-10-20}
|
10
|
+
s.description = %q{Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen scraping fun.
|
11
11
|
}
|
12
12
|
s.email = ["rob ~@nospam@~ rubyforge.org"]
|
13
13
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README"]
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{morph}
|
19
19
|
s.rubygems_version = %q{1.3.7}
|
20
|
-
s.summary = %q{Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen
|
20
|
+
s.summary = %q{Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen scraping fun.}
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
data/spec/lib/morph_spec.rb
CHANGED
@@ -396,7 +396,7 @@ describe Morph do
|
|
396
396
|
it 'should create classes and object instances' do
|
397
397
|
h = {
|
398
398
|
"CompanyDetails"=> {
|
399
|
-
|
399
|
+
:RegAddress=> {
|
400
400
|
"AddressLine"=>["ST DAVID'S HOUSE", "WEST WING", "WOOD STREET", "CARDIFF CF10 1ES"]},
|
401
401
|
"LastFullMemDate"=>"2002-03-25",
|
402
402
|
"xsi:schemaLocation"=>"xmlgwdev.companieshouse.gov.uk/v1-0/schema/CompanyDetails.xsd",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rob McKinnon
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-20 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
description: |
|
38
|
-
Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen
|
38
|
+
Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen scraping fun.
|
39
39
|
|
40
40
|
email:
|
41
41
|
- rob ~@nospam@~ rubyforge.org
|
@@ -100,6 +100,6 @@ rubyforge_project: morph
|
|
100
100
|
rubygems_version: 1.3.7
|
101
101
|
signing_key:
|
102
102
|
specification_version: 3
|
103
|
-
summary: Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen
|
103
|
+
summary: Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen scraping fun.
|
104
104
|
test_files: []
|
105
105
|
|