Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rails_param
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
ikcrm_common
rails_param
Commits
e17d84f4
Commit
e17d84f4
authored
Oct 28, 2014
by
cole bradley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove commented code
parent
7b7c37bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
9 deletions
+2
-9
lib/rails_param/param.rb
+2
-9
No files found.
lib/rails_param/param.rb
View file @
e17d84f4
...
@@ -10,8 +10,6 @@ module RailsParam
...
@@ -10,8 +10,6 @@ module RailsParam
class
MockController
class
MockController
include
RailsParam
::
Param
include
RailsParam
::
Param
attr_accessor
:params
attr_accessor
:params
# def params
# end
end
end
def
param!
(
name
,
type
,
options
=
{})
def
param!
(
name
,
type
,
options
=
{})
...
@@ -27,12 +25,7 @@ module RailsParam
...
@@ -27,12 +25,7 @@ module RailsParam
if
block_given?
if
block_given?
controller
=
RailsParam
::
Param
::
MockController
.
new
controller
=
RailsParam
::
Param
::
MockController
.
new
controller
.
params
=
params
[
name
]
controller
.
params
=
params
[
name
]
# begin
yield
(
controller
)
yield
(
controller
)
# exception.param, exception.options = name, options
# raise InvalidParameterError exception
# end
end
end
rescue
InvalidParameterError
=>
exception
rescue
InvalidParameterError
=>
exception
exception
.
param
||=
name
exception
.
param
||=
name
...
@@ -72,7 +65,7 @@ module RailsParam
...
@@ -72,7 +65,7 @@ module RailsParam
return
Time
.
parse
(
param
)
if
type
==
Time
return
Time
.
parse
(
param
)
if
type
==
Time
return
DateTime
.
parse
(
param
)
if
type
==
DateTime
return
DateTime
.
parse
(
param
)
if
type
==
DateTime
return
Array
(
param
.
split
(
options
[
:delimiter
]
||
","
))
if
type
==
Array
return
Array
(
param
.
split
(
options
[
:delimiter
]
||
","
))
if
type
==
Array
return
Hash
[
param
.
split
(
options
[
:delimiter
]
||
","
).
map
{
|
c
|
c
.
split
(
options
[
:separator
]
||
":"
)
}]
if
type
==
Hash
return
Hash
[
param
.
split
(
options
[
:delimiter
]
||
","
).
map
{
|
c
|
c
.
split
(
options
[
:separator
]
||
":"
)
}]
if
type
==
Hash
return
(
/(false|f|no|n|0)$/i
===
param
.
to_s
?
false
:
(
/(true|t|yes|y|1)$/i
===
param
.
to_s
?
true
:
nil
))
if
type
==
TrueClass
||
type
==
FalseClass
||
type
==
:boolean
return
(
/(false|f|no|n|0)$/i
===
param
.
to_s
?
false
:
(
/(true|t|yes|y|1)$/i
===
param
.
to_s
?
true
:
nil
))
if
type
==
TrueClass
||
type
==
FalseClass
||
type
==
:boolean
if
type
==
BigDecimal
if
type
==
BigDecimal
param
=
param
.
delete
(
'$,'
).
strip
.
to_f
if
param
.
is_a?
(
String
)
param
=
param
.
delete
(
'$,'
).
strip
.
to_f
if
param
.
is_a?
(
String
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment