heading_with_title 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bd9062755809ef946f50ac9478b380a44c0609c
4
- data.tar.gz: 31505b16befbfc56f15ab009108d1baeff771068
3
+ metadata.gz: 9fc73151e9379c8c01fdab6c2d80dffc7946acb9
4
+ data.tar.gz: 1c245e36436d5049b2ef35347645c62e4f89c9d5
5
5
  SHA512:
6
- metadata.gz: 476dc227e90467e50d30de6c5a603217f4b511104f151937da5504c8bf708c6334adc5547932a2ff1bb6bd777282fb85c6755d4bdfcf117d07243005ccaebd38
7
- data.tar.gz: 369585603db4f6791e549fc160605a7c8864bb0115c5c8bae4683f917456d1363bd036a8659cb89d81718958cba8ab2c22f6327e323d692bbc1fa1314d440ff7
6
+ metadata.gz: 4572df0c090d19f2a10248ec1800349a60f06eafc5e2afbe68390d2f17caf8c225b17c55d7e80322f7df38ca49e746ec9b5d5c4445b96ce9feea7b69f7746578
7
+ data.tar.gz: 4f91fa734f44968f30c44f2421f79702c73d6f040e041dec6e168c56947c49eae560263afdd29a461c402ec07d8bbe84fc1a4d9e65de25689a6ad1cb1de77ce6
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .rvmrc
data/README.md CHANGED
@@ -42,8 +42,12 @@ heading, or you call `page_title('Something')` to set page title without heading
42
42
  # just pass hash as argument:
43
43
  <%= heading_with_title username: 'John Doe' %>
44
44
 
45
+ # Also it accepts ActiveRecord model instance
46
+ <% heading_with_title Product.find(777) %>
47
+
45
48
  # Or you might want to set only page title
46
49
  <% page_title 'Users' %>
50
+
47
51
  ```
48
52
  ## Configuration
49
53
 
@@ -74,6 +78,9 @@ end
74
78
 
75
79
  ## Changelog
76
80
 
81
+ ### 0.0.4
82
+ * Improvement: Now heading_with_title accepts ActiveRecord model instances.
83
+
77
84
  ### 0.0.3
78
85
  * Bugfix: Fix Rails application name obtaining
79
86
 
@@ -84,3 +91,7 @@ end
84
91
  ## License
85
92
 
86
93
  [The MIT License](https://github.com/tanraya/heading_with_title/blob/master/MIT-LICENSE)
94
+
95
+
96
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rocsci/heading_with_title/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
97
+
@@ -20,4 +20,5 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency "bundler", "~> 1.3"
21
21
  s.add_development_dependency "rake"
22
22
  s.add_development_dependency "rspec"
23
+ s.add_development_dependency "sqlite3"
23
24
  end
@@ -21,6 +21,8 @@ module HeadingWithTitle
21
21
  t(HeadingWithTitle.default_i18n_key, arg)
22
22
  when String
23
23
  arg
24
+ when ActiveRecord::Base
25
+ arg.to_s
24
26
  else
25
27
  raise ArgumentError, 'Incorrect arguments for heading_with_title!'
26
28
  end
@@ -1,3 +1,3 @@
1
1
  module HeadingWithTitle
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require "heading_with_title"
3
+ require "support/active_record"
3
4
 
4
5
  module HeadingWithTitle
5
6
  module Helpers #:nodoc:
@@ -69,6 +70,10 @@ describe HeadingWithTitle::Helpers do
69
70
  heading_with_title(name: 'John Doe').should == '<h1>Hello John Doe!</h1>'
70
71
  end
71
72
 
73
+ it 'allows ActiveRecord instance' do
74
+ heading_with_title(Product.new).should == '<h1>Tasty Cakes</h1>'
75
+ end
76
+
72
77
  it 'raises ArgumentError on incorrect arguments' do
73
78
  expect { heading_with_title(OpenStruct.new(name: 'Weird')) }.to raise_error(ArgumentError, 'Incorrect arguments for heading_with_title!')
74
79
  end
@@ -0,0 +1,18 @@
1
+ require "active_record"
2
+
3
+ ActiveRecord::Base.establish_connection(
4
+ adapter: 'sqlite3',
5
+ database: ':memory:'
6
+ )
7
+
8
+ ActiveRecord::Migration.create_table :products do |t|
9
+ t.string :name
10
+ t.timestamps
11
+ end
12
+
13
+ class Product < ActiveRecord::Base
14
+ def to_s
15
+ 'Tasty Cakes'
16
+ end
17
+ end
18
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heading_with_title
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozloff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-28 00:00:00.000000000 Z
11
+ date: 2014-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Setting the page heading at the same time with a page title
70
84
  email:
71
85
  - demerest@gmail.com
@@ -84,6 +98,7 @@ files:
84
98
  - lib/heading_with_title/railtie.rb
85
99
  - lib/heading_with_title/version.rb
86
100
  - spec/heading_with_title/helpers_spec.rb
101
+ - spec/support/active_record.rb
87
102
  homepage: https://github.com/rocsci/heading_with_title
88
103
  licenses:
89
104
  - MIT
@@ -110,3 +125,4 @@ specification_version: 4
110
125
  summary: A set of helpers for Rails
111
126
  test_files:
112
127
  - spec/heading_with_title/helpers_spec.rb
128
+ - spec/support/active_record.rb