Skip to content

Commit abb8caa

Browse files
authored
Merge pull request #9 from joneslee85/bump-everything-up-to-date
Bump everything up to date
2 parents 7e1bb76 + d4133f9 commit abb8caa

File tree

16 files changed

+125
-104
lines changed

16 files changed

+125
-104
lines changed

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--colour
2+
--format progress

.travis.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
language: ruby
2+
sudo: false
3+
cache: bundler
24
rvm:
3-
- 1.8.7
4-
- 1.9.2
5-
- 1.9.3
5+
- 2.0.0
6+
- 2.1.0
7+
- 2.1.1
8+
- 2.1.2
9+
- 2.1.3
10+
- 2.1.4
11+
- 2.1.5
12+
- 2.1.6
13+
- 2.1.7
14+
- 2.1.8
15+
- 2.2.0
16+
- 2.2.1
17+
- 2.2.2
18+
- 2.2.3
19+
- 2.2.4
20+
- 2.3.0

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ source "https://rubygems.org"
22

33
gemspec
44

5-
gem "rake", ">= 10.0.4"
6-
gem "rspec", "~> 2.13.0"
5+
gem "rake"
76
gem "tilt"
87
gem "diff-lcs"
98
gem "ruby-prof"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2009 Mike Williams
1+
Copyright (c) 2009-2016 Mike Williams
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.markdown

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Representative
22
==============
33

4+
[![Build Status](https://travis-ci.org/mdub/representative.svg?branch=master)](https://travis-ci.org/mdub/representative)
5+
46
"Representative" makes it easier to create XML or JSON representations of your Ruby objects.
57

68
It works best when you want the output to roughly follow the object structure, but still want complete control of the result.
@@ -12,15 +14,15 @@ Given a Ruby data-structure:
1214

1315
@books = [
1416
Book.new(
15-
:title => "Sailing for old dogs",
17+
:title => "Sailing for old dogs",
1618
:authors => ["Jim Watson"],
1719
:published => Publication.new(
1820
:by => "Credulous Print",
1921
:year => 1994
2022
)
2123
),
2224
Book.new(
23-
:title => "On the horizon",
25+
:title => "On the horizon",
2426
:authors => ["Zoe Primpton", "Stan Ford"],
2527
:published => Publication.new(
2628
:by => "McGraw-Hill",
@@ -37,7 +39,7 @@ Given a Ruby data-structure:
3739
Representative::Nokogiri can be used to generate XML:
3840

3941
xml = Representative::Nokogiri.new do |r|
40-
42+
4143
r.list_of :books, @books do
4244
r.element :title
4345
r.list_of :authors
@@ -46,7 +48,7 @@ Representative::Nokogiri can be used to generate XML:
4648
r.element :year
4749
end
4850
end
49-
51+
5052
end
5153

5254
puts xml.to_s
@@ -98,7 +100,7 @@ Generating JSON
98100
Representative::Json can be used to generate JSON, using exactly the same DSL:
99101

100102
json = Representative::Json.new do |r|
101-
103+
102104
r.list_of :books, @books do
103105
r.element :title
104106
r.list_of :authors
@@ -169,7 +171,7 @@ This registers handlers for "`.xml.rep`" and "`.json.rep`" templates.
169171
Copyright
170172
---------
171173

172-
Copyright (c) 2009 Mike Williams. See LICENSE for details.
174+
Copyright (c) 2009-2016 Mike Williams. See LICENSE for details.
173175

174176
Similar projects
175177
----------------

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require "rspec/core/rake_task"
88

99
RSpec::Core::RakeTask.new(:spec) do |t|
1010
t.pattern = 'spec/**/*_spec.rb'
11-
t.rspec_opts = ["--colour", "--format", "nested"]
1211
end
1312

1413
task :default => :spec

lib/representative/abstract_xml.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require "representative/base"
2+
require "active_support/core_ext/array/extract_options"
23

34
module Representative
45

lib/representative/json.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
require "active_support/core_ext/array"
2-
require "active_support/json"
1+
require "activesupport/json_encoder"
2+
require "active_support/core_ext/array/extract_options"
33
require "representative/base"
44

55
module Representative

lib/representative/nokogiri.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
require "active_support/core_ext"
21
require "nokogiri"
32
require "representative/abstract_xml"
43
require "representative/empty"
54

65
module Representative
7-
6+
87
# Easily generate XML while traversing an object-graph.
98
#
109
class Nokogiri < AbstractXml
11-
10+
1211
def initialize(subject = nil, options = {})
1312
super(subject, options)
1413
@doc = ::Nokogiri::XML::Document.new
@@ -35,7 +34,7 @@ def comment(text)
3534
comment_node = ::Nokogiri::XML::Comment.new(doc, " #{text} ")
3635
current_element.add_child(comment_node)
3736
end
38-
37+
3938
def attribute(name, value_generator = name)
4039
attribute_name = name.to_s.dasherize
4140
value = resolve_value(value_generator)
@@ -45,7 +44,7 @@ def attribute(name, value_generator = name)
4544
end
4645

4746
private
48-
47+
4948
def generate_element(name, resolved_attributes, content_string)
5049
tag_args = [content_string, resolved_attributes].compact
5150
new_element = doc.create_element(name, *tag_args)
@@ -54,13 +53,13 @@ def generate_element(name, resolved_attributes, content_string)
5453
old_element = @current_element
5554
begin
5655
@current_element = new_element
57-
yield
56+
yield
5857
ensure
5958
@current_element = old_element
6059
end
6160
end
6261
end
63-
62+
6463
end
65-
64+
6665
end

lib/representative/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Representative
2-
VERSION = "1.0.5".freeze
2+
VERSION = "1.0.6".freeze
33
end

0 commit comments

Comments
 (0)