Created
March 21, 2016 08:51
-
-
Save jreidinger/3883aa68662e9a7fdc7b to your computer and use it in GitHub Desktop.
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
disks = a_devicegraph.disks # A disks object, Array on steroids | |
disks = disks.with(name: ["/dev/sda", "/dev/sdb"]) # another disks object | |
primary_parts = disks.partitions.with(type: :primary) # A Partitions object, another Array on steroids | |
parts = disks.partitions.with(name: ["/dev/sda2", "/dev/sdc3"]) | |
# equivalent line | |
# parts = a_devicegraph.disks.partitions.with(name: ["/dev/sda2", "/dev/sdc3"]) | |
# Calls to whatever.filesystems returns a Filesystems object which is another Array on steroids | |
# So the equivalent to previous example (https://gist.github.com/ancorgs/9c628ef0f4fa717a2817) would be | |
a_device_graph.filesystems.to_a # all file systems in the devicegraph | |
disks.filesystems.to_a # Filesystems in the chosen disks | |
primary_parts.filesystems.to_a # fs in primary parts of chosen disks | |
parts.filesystems.to_a # Filesystems in sda2 and sdc3 | |
# But you don't need to use #to_a immediately (or at all) | |
disk_query.filesystems.map(&:label) | |
part_fine_query.filesystems.with(label: "bla").first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment