Class: NodeRenderingContext

Inherits:
Object
  • Object
show all
Defined in:
lib/hiptest-publisher/options_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(properties) ⇒ NodeRenderingContext

Returns a new instance of NodeRenderingContext.



320
321
322
323
# File 'lib/hiptest-publisher/options_parser.rb', line 320

def initialize(properties)
  # should contain  :node, :path, :description, :indentation
  @properties = OpenStruct.new(properties)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



325
326
327
# File 'lib/hiptest-publisher/options_parser.rb', line 325

def method_missing(name, *)
  @properties[name]
end

Instance Method Details

#[](key) ⇒ Object



333
334
335
# File 'lib/hiptest-publisher/options_parser.rb', line 333

def [](key)
  @properties[key]
end

#filenameObject



341
342
343
# File 'lib/hiptest-publisher/options_parser.rb', line 341

def filename
  File.basename(@properties.path)
end

#folderObject



345
346
347
# File 'lib/hiptest-publisher/options_parser.rb', line 345

def folder
  File.dirname(@properties.path)
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


337
338
339
# File 'lib/hiptest-publisher/options_parser.rb', line 337

def has_key?(key)
  @properties.respond_to?(key)
end

#nodeObject



329
330
331
# File 'lib/hiptest-publisher/options_parser.rb', line 329

def node
  @properties.node
end

#relative_folderObject



349
350
351
# File 'lib/hiptest-publisher/options_parser.rb', line 349

def relative_folder
  File.dirname(@properties.relative_path)
end

#renderer_addonsObject



353
354
355
356
357
358
# File 'lib/hiptest-publisher/options_parser.rb', line 353

def renderer_addons
  addons = @properties.renderer_addons || ""
  addons.split.map do |addon_name|
    Hiptest.const_get(addon_name)
  end
end