Class: YourKarma::Device
- Inherits:
-
Object
- Object
- YourKarma::Device
- Defined in:
- lib/yourkarma/device.rb
Constant Summary collapse
- IPADDRESS_PATTERN =
/^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Device
constructor
A new instance of Device.
- #valid_ipaddress? ⇒ Boolean
- #waninterface=(attrs) ⇒ Object
- #wifiinterface=(attrs) ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Device
Returns a new instance of Device.
11 12 13 |
# File 'lib/yourkarma/device.rb', line 11 def initialize(attrs = {}) self.attributes = attrs end |
Instance Method Details
#valid_ipaddress? ⇒ Boolean
23 24 25 |
# File 'lib/yourkarma/device.rb', line 23 def valid_ipaddress? self.ipaddress && self.ipaddress.match(IPADDRESS_PATTERN) end |
#waninterface=(attrs) ⇒ Object
15 16 17 |
# File 'lib/yourkarma/device.rb', line 15 def waninterface=(attrs) self.attributes = attrs end |
#wifiinterface=(attrs) ⇒ Object
19 20 21 |
# File 'lib/yourkarma/device.rb', line 19 def wifiinterface=(attrs) self.attributes = attrs end |