Class: Sniffux
- Inherits:
-
Object
show all
- Defined in:
- lib/sniffux.rb,
lib/sniffux/version.rb,
lib/sniffux/action_controller.rb
Defined Under Namespace
Modules: ActionController
Constant Summary
collapse
- VERSION =
"0.0.3"
Instance Method Summary
collapse
Constructor Details
#initialize(string) ⇒ Sniffux
Returns a new instance of Sniffux.
8
9
10
|
# File 'lib/sniffux.rb', line 8
def initialize(string)
@user_agent = UserAgent.parse(string)
end
|
Instance Method Details
#cancel_left? ⇒ Boolean
12
13
14
15
16
17
|
# File 'lib/sniffux.rb', line 12
def cancel_left?
!cancel_right?
end
|
#cancel_right? ⇒ Boolean
19
20
21
22
23
24
|
# File 'lib/sniffux.rb', line 19
def cancel_right?
%w(Windows).include?(@user_agent.platform) ||
%w(AROS).include?(@user_agent.os) ||
!!(@user_agent.os =~ /Android/)
end
|
#cancel_side ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/sniffux.rb', line 26
def cancel_side
if cancel_right?
'right'
else
'left'
end
end
|
#close_left? ⇒ Boolean
50
51
52
53
54
|
# File 'lib/sniffux.rb', line 50
def close_left?
!close_right?
end
|
#close_right? ⇒ Boolean
56
57
58
59
60
|
# File 'lib/sniffux.rb', line 56
def close_right?
%w(Windows).include?(@user_agent.platform) ||
!!(@user_agent.os =~ /CrOS/)
end
|
#close_side ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/sniffux.rb', line 62
def close_side
if close_right?
'right'
else
'left'
end
end
|
#ok_left? ⇒ Boolean
34
35
36
|
# File 'lib/sniffux.rb', line 34
def ok_left?
cancel_right?
end
|
#ok_right? ⇒ Boolean
38
39
40
|
# File 'lib/sniffux.rb', line 38
def ok_right?
cancel_left?
end
|
#ok_side ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/sniffux.rb', line 42
def ok_side
if ok_right?
'right'
else
'left'
end
end
|