Method: CloudFlock::Task::ServerProfile#select
- Defined in:
- lib/cloudflock/task/server-profile.rb
#select(&block) ⇒ Object
Public: Select from the info Array, passing Section titles to the block provided and returning a list of entries contained within matching sections.
Examples
profile.select { |title| title == 'Memory Statistics' }
# => [...]
profile.select { |title| /Memory/.match title }
# => [...]
Yields titles of Section structs (Strings).
Returns an Array of Entry structs.
53 54 55 56 57 |
# File 'lib/cloudflock/task/server-profile.rb', line 53 def select(&block) sections = @info.select { |section| block.call(section.title) } sections.map! { |section| section.entries } sections.flatten end |