Class: Undies::NamedSource

Inherits:
Object
  • Object
show all
Defined in:
lib/undies/source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ NamedSource

Returns a new instance of NamedSource.



77
78
79
80
# File 'lib/undies/source.rb', line 77

def initialize(*args, &block)
  args << block if block
  self.args = args
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



75
76
77
# File 'lib/undies/source.rb', line 75

def file
  @file
end

#optsObject

Returns the value of attribute opts.



75
76
77
# File 'lib/undies/source.rb', line 75

def opts
  @opts
end

#procObject

Returns the value of attribute proc.



75
76
77
# File 'lib/undies/source.rb', line 75

def proc
  @proc
end

Instance Method Details

#==(other_named_source) ⇒ Object



82
83
84
85
86
# File 'lib/undies/source.rb', line 82

def ==(other_named_source)
  self.file == other_named_source.file &&
  self.opts == other_named_source.opts &&
  self.proc == other_named_source.proc
end

#argsObject



96
97
98
# File 'lib/undies/source.rb', line 96

def args
  [self.file, self.opts, self.proc]
end

#args=(values) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/undies/source.rb', line 88

def args=(values)
  self.proc, self.opts, self.file = [
    values.last.kind_of?(::Proc)   ? values.pop : nil,
    values.last.kind_of?(::Hash)   ? values.pop : {},
    values.last.kind_of?(::String) ? values.pop : nil
  ]
end