Class: Svnx::Base::Options
- Inherits:
-
Object
- Object
- Svnx::Base::Options
- Defined in:
- lib/svnx/base/options.rb
Direct Known Subclasses
Add::Options, Svnx::Blame::Options, Cat::Options, Commit::Options, Diff::Options, Info::Options, Log::Options, Merge::Options, Propget::Options, Propset::Options, Status::Options, Update::Options
Instance Method Summary collapse
- #get_args(field) ⇒ Object
-
#initialize(args) ⇒ Options
constructor
A new instance of Options.
- #options_to_args ⇒ Object
- #to_args ⇒ Object
Methods included from Fields
#assign, #create_invalid_fields_message, #fields, included, #validate
Methods included from Fields::ClassMethods
#attr_readers, #has_field, #has_fields
Methods included from Tags
Methods included from Tags::ClassMethods
#has, #has_tag_argument, #has_tag_field, #has_tags, #mapping, #to_tag
Constructor Details
#initialize(args) ⇒ Options
Returns a new instance of Options.
17 18 19 20 21 22 |
# File 'lib/svnx/base/options.rb', line 17 def initialize args fkeys = fields.keys assign args, fkeys validate args, fkeys end |
Instance Method Details
#get_args(field) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/svnx/base/options.rb', line 36 def get_args field val = fields[field] case val when Proc val.call self when nil send field else val end end |
#options_to_args ⇒ Object
24 25 26 27 28 |
# File 'lib/svnx/base/options.rb', line 24 def fields.keys.collect do |fld| [ fld, get_args(fld) ] end end |
#to_args ⇒ Object
30 31 32 33 34 |
# File 'lib/svnx/base/options.rb', line 30 def to_args .collect do |opt| send(opt.first) ? opt[1] : nil end.compact.flatten end |