mjacobus/semistatic · page.rb
ruby logo
def part(name)
      parts.select {|p| p.name.downcase == name.to_s.downcase }.first
    end
Similar code snippets
1.
aws/aws-sdk-ruby · helper.rb
Match rating: 53.33% · See similar code snippets
ruby logo
def downcase_first(name)
      if name[0] =~/[A-Z]/
        name.size == 1 ? name.downcase : name[0].downcase + name[1..-1]
      else
        name
      end
    end
2.
raul/pt · client.rb
Match rating: 47.02% · See similar code snippets
ruby logo
def find_member(query)
      project.memberships.detect do |m|
        m.person.name.downcase.start_with?(query.downcase) || m.person.initials.downcase == query.downcase
      end
    end
3.
addagger/gaigo · langs.rb
Match rating: 46.52% · See similar code snippets
ruby logo
def get_by_en(name)
      self.find {|i| i.en.downcase == name.downcase.to_s}
    end
4.
rails/rails · methods.rb
Match rating: 45.85% · See similar code snippets
ruby logo
def const_regexp(camel_cased_word)
        parts = camel_cased_word.split("::")

        return Regexp.escape(camel_cased_word) if parts.blank?

        last = parts.pop

        parts.reverse.inject(last) do |acc, part|
          part.empty? ? acc : "#{part}(::#{acc})?"
        end
      end
5.
Calyhre/dribbble · utils.rb
Match rating: 45.74% · See similar code snippets
ruby logo
def class_name
      @_class_name ||= self.is_a?(Class) ? name.split('::').last.downcase : self.class.name.split('::').last.downcase
    end
6.
mailgun/mailgun-ruby · message_builder.rb
Match rating: 45.65% · See similar code snippets
ruby logo
def bool_lookup(value)
      return 'yes' if %w(true yes yep).include? value.to_s.downcase
      return 'no' if %w(false no nope).include? value.to_s.downcase
      value
    end
7.
github/linguist · inflector.rb
Match rating: 45.64% · See similar code snippets
ruby logo
def const_regexp(camel_cased_word) #:nodoc:
      parts = camel_cased_word.split("::")
      last  = parts.pop

      parts.reverse.inject(last) do |acc, part|
        part.empty? ? acc : "#{part}(::#{acc})?"
      end
    end
8.
yivo/activerecord-traits · list.rb
Match rating: 45.08% · See similar code snippets
ruby logo
def by_name(name)
      name = name.to_sym if name.kind_of?(String)
      find { |attr| attr.name == name }
    end
9.
altabyte/ebay_trader · sax_handler.rb
Match rating: 44.0% · See similar code snippets
ruby logo
def attr(name, value)
      return if name.to_s.downcase == 'xmlns'
      last = path.last
      return if last.nil?

      name = name[0].upcase + name[1...name.length]
      @attributes[name] = value
    end
10.
toptal/chewy · query.rb
Match rating: 43.91% · See similar code snippets
ruby logo
def _build_fqn_aggs
      named_aggs = {}
      @_indexes.each do |index|
        named_aggs[index.to_s.downcase] ||= {}
        index.types.each do |type|
          named_aggs[index.to_s.downcase][type.to_s.downcase] ||= {}
          type._agg_defs.each do |agg_name, prc|
            named_aggs[index.to_s.downcase][type.to_s.downcase][agg_name.to_s.downcase] = prc.call
          end
        end
      end
      named_aggs
    end