Module: Bugwatch::Attrs

Included in:
Commit, Diff
Defined in:
lib/bugwatch/attrs.rb

Instance Method Summary collapse

Instance Method Details

#attrs(*attributes) ⇒ Object



35
36
37
38
39
# File 'lib/bugwatch/attrs.rb', line 35

def attrs(*attributes)
  define_attr_reader(attributes) do |attr|
    attr
  end
end

#lazy_attrs(*attributes) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/bugwatch/attrs.rb', line 41

def lazy_attrs(*attributes)
  define_attr_reader(attributes) do |attr|
    if attr.respond_to? :call
      attr.call
    else
      attr
    end
  end
end