Method: Wash::Entry.attributes

Defined in:
lib/wash/entry.rb

.attributes(attr, *attrs) ⇒ Object

attributes is a class-level tag specifying all the attributes that make sense for instances of this specific kind of entry. It will pass the specified attributes along to attr_accessor so that instances can set their values. For example, something like

Examples:

class Foo
  # Instances of Foo will be able to set the @mtime and @size fields
  attributes :mtime, :size

  def initialize(mtime, size)
    @mtime = mtime
    @size = size
  end
end

Parameters:

  • attr (Symbol)

    An attribute that will be set

  • attrs (Symbol)

    More attributes that will be set



26
27
28
29
# File 'lib/wash/entry.rb', line 26

def attributes(attr, *attrs)
  @attributes ||= []
  @attributes += set_fields(attr, *attrs)
end