Class: Kanrisuru::Remote::Fstab::Entry
- Inherits:
-
Object
- Object
- Kanrisuru::Remote::Fstab::Entry
- Defined in:
- lib/kanrisuru/remote/fstab/entry.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
readonly
Returns the value of attribute device.
-
#freq ⇒ Object
readonly
Returns the value of attribute freq.
-
#invalid ⇒ Object
readonly
Returns the value of attribute invalid.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#mount_point ⇒ Object
Returns the value of attribute mount_point.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#passno ⇒ Object
readonly
Returns the value of attribute passno.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Entry
constructor
A new instance of Entry.
- #inspect ⇒ Object
- #to_s(override = nil) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ Entry
Returns a new instance of Entry.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 10 def initialize(opts = {}) @host = opts[:host] @line = opts[:line] @default = nil @device = opts[:device] || nil @opts = opts[:opts] || nil @label = opts[:label] || nil @uuid = opts[:uuid] || nil @mount_point = opts[:mount_point] || nil @type = opts[:type] || nil @freq = opts[:freq] || nil @passno = opts[:passno] || nil @changed = false @ucount = 0 @special = false @invalid = false if Kanrisuru::Util.present?(@line) && @line.instance_of?(String) parse_line! elsif (Kanrisuru::Util.present?(@opts) && @opts.instance_of?(String)) || @opts.instance_of?(Hash) @opts = Kanrisuru::Remote::Fstab::Options.new(@type, @opts) end end |
Instance Attribute Details
#device ⇒ Object (readonly)
Returns the value of attribute device.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def device @device end |
#freq ⇒ Object (readonly)
Returns the value of attribute freq.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def freq @freq end |
#invalid ⇒ Object (readonly)
Returns the value of attribute invalid.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def invalid @invalid end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def label @label end |
#mount_point ⇒ Object
Returns the value of attribute mount_point.
8 9 10 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 8 def mount_point @mount_point end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def opts @opts end |
#passno ⇒ Object (readonly)
Returns the value of attribute passno.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def passno @passno end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def type @type end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
7 8 9 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 7 def uuid @uuid end |
Instance Method Details
#inspect ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 38 def inspect str = '#<Kanrisuru::Remote::Fstab::Entry:0x%<object_id>s ' \ '@line=%<line>s @device=%<device>s @label=%<label>s' \ '@uuid=%<uuid>s @freq=%<freq>s @pasno=%<passno>s' \ '@opts=%<opts>s}>' format( str, object_id: object_id, line: @line, device: @device, label: @label, uuid: @uuid, freq: @freq, passno: @passno, opts: @opts.inspect ) end |
#to_s(override = nil) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 61 def to_s(override = nil) mode = override || @default case mode when 'uuid' "UUID=#{@uuid} #{@mount_point} #{@type} #{@opts} #{@freq} #{@passno}" when 'label' "LABEL=#{@label} #{@mount_point} #{@type} #{@opts} #{@freq} #{@passno}" else "#{@device} #{@mount_point} #{@type} #{@opts} #{@freq} #{@passno}" end end |
#valid? ⇒ Boolean
57 58 59 |
# File 'lib/kanrisuru/remote/fstab/entry.rb', line 57 def valid? !@invalid end |