Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 6bd3e22

Browse files
committed
updated src libs, added listen and block methods to History
1 parent 4300f63 commit 6bd3e22

File tree

7 files changed

+61
-22
lines changed

7 files changed

+61
-22
lines changed

.rubocop.yml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
1-
Style/MultilineBlockChain:
2-
Description: 'Avoid multi-line chains of blocks.'
3-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
4-
Enabled: false
1+
## Layout
52

6-
Style/Documentation:
7-
Description: 'Document classes and non-namespace modules.'
8-
Enabled: false
9-
Exclude:
10-
- 'spec/**/*'
11-
- 'test/**/*'
12-
13-
# Multi-line method chaining should be done with trailing dots.
14-
Style/DotPosition:
3+
Layout/DotPosition:
154
EnforcedStyle: leading
165
SupportedStyles:
176
- leading
187
- trailing
198

20-
Style/MutableConstant:
21-
Description: 'Do not assign mutable objects to constants.'
22-
Enabled: false
9+
10+
## Metrics
2311

2412
Metrics/AbcSize:
2513
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
@@ -33,6 +21,9 @@ Metrics/BlockLength:
3321
Metrics/LineLength:
3422
Max: 100
3523

24+
25+
## Style
26+
3627
Style/BlockDelimiters:
3728
EnforcedStyle: line_count_based
3829
SupportedStyles:
@@ -103,3 +94,19 @@ Style/BlockDelimiters:
10394
- lambda
10495
- proc
10596
- it
97+
98+
Style/Documentation:
99+
Description: 'Document classes and non-namespace modules.'
100+
Enabled: false
101+
Exclude:
102+
- 'spec/**/*'
103+
- 'test/**/*'
104+
105+
Style/MultilineBlockChain:
106+
Description: 'Avoid multi-line chains of blocks.'
107+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
108+
Enabled: false
109+
110+
Style/MutableConstant:
111+
Description: 'Do not assign mutable objects to constants.'
112+
Enabled: false

lib/hyper-router/history.rb

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,32 @@ def location
1414
HyperRouter::Location.new(`#{@native}.location`)
1515
end
1616

17-
alias_native :block
17+
def block(message = nil)
18+
if message
19+
native_block(message.to_n)
20+
else
21+
native_block do |location, action|
22+
yield Location.new(location), action
23+
end
24+
end
25+
end
26+
27+
def listen
28+
native_listen do |location, action|
29+
yield Location.new(location), action
30+
end
31+
end
32+
33+
alias_native :action
34+
alias_native :native_block, :block
1835
alias_native :create_href, :createHref
36+
alias_native :entries
1937
alias_native :go
2038
alias_native :go_back, :goBack
2139
alias_native :go_forward, :goForward
40+
alias_native :index
41+
alias_native :length
42+
alias_native :native_listen, :listen
2243
alias_native :push, :push
2344
alias_native :replace, :replace
2445
end

lib/hyper-router/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module HyperRouter
2-
VERSION = '4.1.2'
2+
VERSION = '4.2.2'
33
end

lib/src/history.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/react-router-dom.min.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/react-router.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "hyper-router",
3+
"version": "4.2.2",
4+
"dependencies": {
5+
"history": "^4.7.2",
6+
"react": "^15.6.1",
7+
"react-dom": "^15.6.1",
8+
"react-router": "^4.2.0",
9+
"react-router-dom": "^4.2.2"
10+
},
11+
"devDependencies": {}
12+
}

0 commit comments

Comments
 (0)