Class: Yast::Term
- Inherits:
-
Object
- Object
- Yast::Term
- Extended by:
- Forwardable
- Includes:
- Comparable, Enumerable
- Defined in:
- src/ruby/yast/ops.rb,
src/ruby/yast/term.rb,
src/ruby/yast/yast.rb
Overview
predefine term to avoid circular dependency
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
term parameters.
-
#value ⇒ Object
readonly
term symbol.
Instance Method Summary collapse
-
#<< ⇒ Object
Append element to params.
- #<=>(other) ⇒ Object
-
#[] ⇒ Object
Access element of params.
-
#[]= ⇒ Object
Assign element to params.
- #clone ⇒ Object
-
#each ⇒ Object
Delegated directly to params.
-
#empty? ⇒ true, false
If params are empty.
-
#initialize(value, *params) ⇒ Term
constructor
A new instance of Term.
-
#nested_find(&block) ⇒ Object?
Find Object that match block even if it is in deep structure of nested terms last_hbox = content.nested_find do |t| t.all? { |i| i.value == :InputField } end last_hbox << InputField(Id(:input3), "Input3") if more_info?.
-
#size ⇒ Integer
Size of params.
- #to_s ⇒ Object
Constructor Details
#initialize(value, *params) ⇒ Term
Returns a new instance of Term.
44 45 46 47 |
# File 'src/ruby/yast/term.rb', line 44 def initialize(value, *params) @value = value @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
term parameters
42 43 44 |
# File 'src/ruby/yast/term.rb', line 42 def params @params end |
#value ⇒ Object (readonly)
term symbol
40 41 42 |
# File 'src/ruby/yast/term.rb', line 40 def value @value end |
Instance Method Details
#<< ⇒ Object
Append element to params
37 |
# File 'src/ruby/yast/term.rb', line 37 def_delegators :@params, :each, :size, :empty?, :[], :[]=, :<< |
#<=>(other) ⇒ Object
90 91 92 93 94 95 96 97 |
# File 'src/ruby/yast/term.rb', line 90 def <=>(other) return nil unless other.is_a? self.class res = value <=> other.value return res if res != 0 list = Ops.comparable_object(params) list <=> other.params end |
#[] ⇒ Object
Access element of params
37 |
# File 'src/ruby/yast/term.rb', line 37 def_delegators :@params, :each, :size, :empty?, :[], :[]=, :<< |
#[]= ⇒ Object
Assign element to params
37 |
# File 'src/ruby/yast/term.rb', line 37 def_delegators :@params, :each, :size, :empty?, :[], :[]=, :<< |
#clone ⇒ Object
82 83 84 |
# File 'src/ruby/yast/term.rb', line 82 def clone Yast::Term.new value, *Yast.deep_copy(params) end |
#each ⇒ Object
Delegated directly to params
37 |
# File 'src/ruby/yast/term.rb', line 37 def_delegators :@params, :each, :size, :empty?, :[], :[]=, :<< |
#empty? ⇒ true, false
Returns if params are empty.
37 |
# File 'src/ruby/yast/term.rb', line 37 def_delegators :@params, :each, :size, :empty?, :[], :[]=, :<< |
#nested_find(&block) ⇒ Object?
Find Object that match block even if it is in deep structure of nested terms last_hbox = content.nested_find do |t| t.all? { |i| i.value == :InputField } end last_hbox << InputField(Id(:input3), "Input3") if more_info?
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'src/ruby/yast/term.rb', line 69 def nested_find(&block) res = find(&block) return res if res each do |o| next unless o.respond_to?(:nested_find) res = o.nested_find(&block) break if res end res end |
#size ⇒ Integer
Returns size of params.
37 |
# File 'src/ruby/yast/term.rb', line 37 def_delegators :@params, :each, :size, :empty?, :[], :[]=, :<< |