Class: BitGirder::Core::ObjectPath
- Inherits:
-
Object
- Object
- BitGirder::Core::ObjectPath
- Extended by:
- BitGirderMethods
- Includes:
- BitGirderMethods
- Defined in:
- lib/bitgirder/core.rb
Direct Known Subclasses
Constant Summary
Constants included from BitGirderMethods
BitGirderMethods::PARAM_TYPE_ARG, BitGirderMethods::PARAM_TYPE_ENVVAR, BitGirderMethods::PARAM_TYPE_KEY
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Class Method Summary collapse
-
.get_root(root_elt) ⇒ Object
Returns a path starting with the specified root element.
- .get_root_list ⇒ Object
Instance Method Summary collapse
- #descend(elt) ⇒ Object
- #format(formatter = DefaultObjectPathFormatter.new) ⇒ Object
-
#initialize(parent) ⇒ ObjectPath
constructor
A new instance of ObjectPath.
- #start_list ⇒ Object
Methods included from BitGirderMethods
argv_to_argh, check_fail_prefix, class_name_to_sym, code, compares_to, console, ext_to_class_name, ext_to_sym, has_env, has_key, has_keys, nonnegative, not_nil, positive, raisef, set_from_key, set_var, split_argv, sym_to_cli_switch, sym_to_ext_id, to_bool, unpack_argv_array, unpack_argv_hash, warn
Constructor Details
#initialize(parent) ⇒ ObjectPath
Returns a new instance of ObjectPath.
1212 1213 1214 |
# File 'lib/bitgirder/core.rb', line 1212 def initialize( parent ) @parent = parent # parent nil ==> this is a root path end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
1207 1208 1209 |
# File 'lib/bitgirder/core.rb', line 1207 def parent @parent end |
Class Method Details
.get_root(root_elt) ⇒ Object
Returns a path starting with the specified root element
1225 1226 1227 1228 1229 |
# File 'lib/bitgirder/core.rb', line 1225 def self.get_root( root_elt ) not_nil( root_elt, :root_elt ) DictionaryPath.send( :new, nil, root_elt ) end |
.get_root_list ⇒ Object
1231 1232 1233 |
# File 'lib/bitgirder/core.rb', line 1231 def self.get_root_list ListPath.send( :new, nil, 0 ) end |
Instance Method Details
#descend(elt) ⇒ Object
1216 1217 1218 |
# File 'lib/bitgirder/core.rb', line 1216 def descend( elt ) DictionaryPath.send( :new, self, not_nil( elt, "elt" ) ) end |
#format(formatter = DefaultObjectPathFormatter.new) ⇒ Object
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 |
# File 'lib/bitgirder/core.rb', line 1250 def format( formatter = DefaultObjectPathFormatter.new ) not_nil( formatter, "formatter" ) formatter.format_path_start( str = "" ) collect_path.each_with_index do |elt, idx| case elt when DictionaryPath formatter.format_separator( str ) unless idx == 0 formatter.format_key( str, elt.key ) when ListPath then formatter.format_list_index( str, elt.index ) else raise "Unexpected path type: #{elt.class}" end end str end |
#start_list ⇒ Object
1220 1221 1222 |
# File 'lib/bitgirder/core.rb', line 1220 def start_list ListPath.send( :new, self, 0 ) end |