Class: FPM::RakeTask::Options
- Inherits:
-
Object
- Object
- FPM::RakeTask::Options
- Defined in:
- lib/fpm/rake_task.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
Instance Method Summary collapse
-
#initialize(defaults = nil) ⇒ Options
constructor
A new instance of Options.
- #method_missing(m, *args) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(defaults = nil) ⇒ Options
Returns a new instance of Options.
9 10 11 12 13 14 15 |
# File 'lib/fpm/rake_task.rb', line 9 def initialize(defaults=nil) if defaults.nil? @h = Hash.new else @h = defaults end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/fpm/rake_task.rb', line 17 def method_missing(m, *args) if m.end_with?("=") raise ArgumentError, "#{self.class.name}##{m} ... Expected 1 arg, got #{args.length}" if args.length != 1 @h[m[0...-1]] = args[0] else raise ArgumentError, "Expected 0 arg, got #{args.length}" if args.length != 0 return @h[m] end end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
7 8 9 |
# File 'lib/fpm/rake_task.rb', line 7 def args @args end |
Instance Method Details
#to_h ⇒ Object
27 28 29 |
# File 'lib/fpm/rake_task.rb', line 27 def to_h return @h end |