Two approaches to interfaces in Ruby:
Using inheritance in a cleaner way. It allows abstract classes, but needs a custom inheritance chain and only supports 1 interface.
module Interface
attr_accessor :is_abstract
def abstract| openapi: 3.0.1 | |
| info: | |
| title: Chainloop Platform API | |
| contact: | |
| name: Chainloop | |
| url: https://chainloop.dev | |
| email: [email protected] | |
| version: "1.0" | |
| servers: | |
| - url: / |
| { | |
| "mediaType": "application/vnd.dev.sigstore.bundle+json;version=0.3", | |
| "verificationMaterial": { | |
| "certificate": { | |
| "rawBytes": "MIIDtzCCAZ+gAwIBAgIUHfh44qKz/2gMfB9BpJea03EW5SowDQYJKoZIhvcNAQELBQAwXjELMAkGA1UEBhMCRVMxEzARBgNVBAgMClNvbWUtU3RhdGUxEjAQBgNVBAoMCUNoYWlubG9vcDESMBAGA1UECwwJY2hhaW5sb29wMRIwEAYDVQQDDAljaGFpbmxvb3AwHhcNMjUwMjEyMDkxOTEzWhcNMjUwMjEyMDkyOTEzWjAvMS0wKwYDVQQKEyQxOGMzZjc4Mi00OTM2LTQ2MzAtYWI4ZC0yMGI1MTEzNjY2OTkwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATKeTBItaVgTUP55i2Xh4ygIvWeeQGGezrb1xee1k/h3COyK37D/xR+uo8/wBnti02rWJmsZQtOq7CZwONU48n6o2cwZTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwHQYDVR0OBBYEFN8DZs+da6GELfQB1YuAfNay2rXPMB8GA1UdIwQYMBaAFKDk5Tdk8eOOMf/+GDw+62HNH6XKMA0GCSqGSIb3DQEBCwUAA4ICAQBwFFmXUNEB5yvD96iFclWxPhiCC+nGSrZl/Mq3emOQD31jkSgvH+SBkoLOG+CUwN3GANmSP99hQjcQUZW7WTvlrScUNVKmhKoODhlwajjbZ/FHK4JcKRX+2JlCPAauRiP2Z5ZSTqQT0CySs/eDdffMxzG6bzRJN/+fQheKbdnHwFgIuF2QD3TDPhXj8D7mHalWNAf4Urq7tR+8GJj9LhQwz5ioqBLBN5FxngpVZGcKX+B+jbGXij/s8Zn8PXJFQ+YtFu65++AGVWS0HpPMUDH6n/M/oInm |
| # Taken from https://github.com/lsegal/yard-examples/blob/master/override/override.rb | |
| require 'yard' | |
| # Register the tag to be recognized by the parser | |
| YARD::Tags::Library.define_tag 'Overriden Method', :override | |
| # Parse the ruby file | |
| YARD.parse('example_code.rb') |
| task buildFrontend(type: Exec){ | |
| workingDir './frontend' | |
| if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) { | |
| commandLine('cmd', '/c', 'npm install') | |
| commandLine('cmd', '/c', 'npm run build') | |
| } | |
| else { | |
| commandLine('sh', '-c', 'npm install') | |
| commandLine('sh', '-c', 'npm run build') | |
| } |
Imagine this case:
class Account < ActiveRecord::Base
def transfer(other, quantity)
tries = 0
begin
tries += 1
transaction do
self.quantity -= quantityI hereby claim:
To claim this, I am signing this object:
| package com.myapp.anim; | |
| import android.view.View; | |
| import android.view.ViewGroup.LayoutParams; | |
| import android.view.animation.Animation; | |
| import android.view.animation.Transformation; | |
| import android.widget.LinearLayout; | |
| public class CollapseAnimation extends Animation { |
| import java.io.Serializable; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.List; | |
| import java.util.Map; | |
| import org.springframework.data.domain.Page; | |
| import org.springframework.data.domain.Pageable; | |
| import org.springframework.data.domain.Sort; |