-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
bootstrap_text_input
to take an array for the addon
option.
Make `false.present?` return false like in ActiveSupport.
- Loading branch information
1 parent
13b8b91
commit 740645c
Showing
3 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
class Object | ||
def present? = !blank? | ||
|
||
def blank? = false | ||
|
||
def try(method, *args) | ||
return nil unless self.respond_to?(method) | ||
return send(method, *args) | ||
send(method, *args) | ||
end | ||
end | ||
|
||
class NilClass | ||
def blank? = true | ||
|
||
def try(*) = nil | ||
end | ||
|
||
class FalseClass | ||
def blank? = true | ||
end | ||
|
||
class String | ||
def blank? = strip.empty? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters