Class: Undies::NamedSource
- Inherits:
-
Object
- Object
- Undies::NamedSource
- Defined in:
- lib/undies/named_source.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#proc ⇒ Object
Returns the value of attribute proc.
Instance Method Summary collapse
- #==(other_named_source) ⇒ Object
- #args ⇒ Object
- #args=(values) ⇒ Object
-
#initialize(*args, &block) ⇒ NamedSource
constructor
A new instance of NamedSource.
Constructor Details
#initialize(*args, &block) ⇒ NamedSource
Returns a new instance of NamedSource.
9 10 11 12 |
# File 'lib/undies/named_source.rb', line 9 def initialize(*args, &block) args << block if block self.args = args end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/undies/named_source.rb', line 7 def file @file end |
#opts ⇒ Object
Returns the value of attribute opts.
7 8 9 |
# File 'lib/undies/named_source.rb', line 7 def opts @opts end |
#proc ⇒ Object
Returns the value of attribute proc.
7 8 9 |
# File 'lib/undies/named_source.rb', line 7 def proc @proc end |
Instance Method Details
#==(other_named_source) ⇒ Object
14 15 16 17 18 |
# File 'lib/undies/named_source.rb', line 14 def ==(other_named_source) self.file == other_named_source.file && self.opts == other_named_source.opts && self.proc == other_named_source.proc end |
#args ⇒ Object
28 29 30 |
# File 'lib/undies/named_source.rb', line 28 def args [self.file, self.opts, self.proc] end |
#args=(values) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/undies/named_source.rb', line 20 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 |