class IndifferentAccessOpenStruct

Public Instance Methods

[](k) click to toggle source
# File lib/githooks/core_ext/ostruct.rb, line 33
def [](k)
  public_send(k)
end
[]=(k, v) click to toggle source
# File lib/githooks/core_ext/ostruct.rb, line 37
def []=(k, v)
  public_send("#{k}=", v)
end
new_ostruct_member(name) click to toggle source
Calls superclass method
# File lib/githooks/core_ext/ostruct.rb, line 23
def new_ostruct_member(name)
  return super unless name.to_s.include? '-'

  original_name, sanitized_name = name, name.to_s.gsub('-', '_').to_sym
  return if respond_to?(sanitized_name)

  define_singleton_method(sanitized_name) { @table[original_name] }
  define_singleton_method("#{sanitized_name}=") { |x| @table[original_name] = x }
end
to_h() click to toggle source
# File lib/githooks/core_ext/ostruct.rb, line 41
def to_h
  Thor::CoreExt::HashWithIndifferentAccess.new(@table)
end