Mailinglist Archive: yast-devel (87 mails)

< Previous Next >
Re: [yast-devel] Feedback needed! Hack Week project to re-define storage-ng API
On Fri, Feb 24, 2017 at 02:28:13PM +0100, Josef Reidinger wrote:
On Fri, 24 Feb 2017 14:02:46 +0100
Arvin Schnell <aschnell@xxxxxxxx> wrote:

On Fri, Feb 24, 2017 at 01:51:42PM +0100, Josef Reidinger wrote:

Let see how it will work in reality in bootloader code with


def with_btrfs?(partition)
partition.filesystem.type == ::Storage::FsType_BTRFS
rescue Storage::WrongNumberOfChildren, Storage::DeviceHasWrongType
# No filesystem in the partition

can be:

def with_btrfs?(partition)

Or can be:

def with_btrfs?(partition)
partition.has_filesystem && is_btrfs(partition.filesystem)

No exceptions, no NullObject, no enum, no type classes. For me
straightforward readable code.

As I already wrote: The style is up to you.

ciao Arvin

Just question. Where is defined method is_btrfs? It is in ruby global
namespace? or Yast namespace? I am not aware that such method exists.

Mea culpa. In C++ it is 'storage::is_btrfs()' and in Ruby

Even this minor renaming of functions confuses me once in a while
(and not only me).

ciao Arvin

Arvin Schnell, <aschnell@xxxxxxxx>
Senior Software Engineer, Research & Development
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284
(AG Nürnberg)
Maxfeldstraße 5
90409 Nürnberg
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >