class Evil::Struct::Attributes

Handler for shared options

Public Class Methods

call(*args, &block) click to toggle source

@private

# File lib/evil/struct/attributes.rb, line 4
def self.call(*args, &block)
  new(*args).instance_eval(&block)
end
new(klass, **options) click to toggle source
# File lib/evil/struct/attributes.rb, line 10
def initialize(klass, **options)
  @klass   = klass
  @options = options
end

Private Instance Methods

attribute(name, type = nil, **options) click to toggle source

Declares an attribute that shares options of the block @param (see Struct.attribute) @option (see Struct.attribute) @return (see Struct.attribute)

# File lib/evil/struct/attributes.rb, line 19
def attribute(name, type = nil, **options)
  @klass.send :attribute, name, type, @options.merge(options)
end
Also aliased as: option, param
option(name, type = nil, **options)
Alias for: attribute
param(name, type = nil, **options)
Alias for: attribute